• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MapObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MapObject的典型用法代码示例。如果您正苦于以下问题:C# MapObject类的具体用法?C# MapObject怎么用?C# MapObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MapObject类属于命名空间,在下文中一共展示了MapObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddObject

        public void AddObject(Point index, MapObject obj)
        {
            if (!_objects.ContainsKey(index))
                _objects.Add(index, new List<MapObject>());

            _objects[index].Add(obj);
        }
开发者ID:ktj007,项目名称:Lz,代码行数:7,代码来源:WorldMap.cs


示例2: CreateGeometry

 public void CreateGeometry(MapObject parent)
 {
     foreach (Aerofoil aerofoil in aerofoils)
     {
         aerofoil.CreateGeometry(parent, this);
     }
 }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:7,代码来源:FlightModel.cs


示例3: OnGetObjectBounds

        protected override void OnGetObjectBounds( MapObject obj, List<Rect> rectangles )
        {
            //RTSCharacter
            RTSCharacter character = obj as RTSCharacter;
            if( character != null )
            {
                float radius = character.Type.Radius;
                rectangles.Add( new Rect(
                    obj.Position.ToVec2() - new Vec2( radius, radius ),
                    obj.Position.ToVec2() + new Vec2( radius, radius ) ) );
                return;
            }

            //all other objects
            if( obj.PhysicsModel != null )
            {
                foreach( Body body in obj.PhysicsModel.Bodies )
                {
                    foreach( Shape shape in body.Shapes )
                    {
                        if( shape.ContactGroup == (int)ContactGroup.NoContact )
                            continue;

                        Bounds bounds = shape.GetGlobalBounds();
                        rectangles.Add( new Rect( bounds.Minimum.ToVec2(), bounds.Maximum.ToVec2() ) );
                    }
                }
                return;
            }

            //base.OnGetObjectBounds( obj, rectangles );
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:32,代码来源:RTSGridPathFindSystem.cs


示例4: Start

    protected override void Start()
    {
        base.Start();

        mapObject = GetComponent<MapObject>();
        movement = GetComponent<SimpleMovement>();
    }
开发者ID:CppMaster,项目名称:SemiPlatformer,代码行数:7,代码来源:MoveAI.cs


示例5: UpdateCollision

        internal static Rectangle UpdateCollision(this GameObject gameObject, Rectangle Destination, Rectangle old, MapObject currentMap)
        {
            foreach (GameTile tile in currentMap.Tiles)
            {
                if (tile.ValidTile && Destination.Intersects(tile.Destination))
                {

                    Rectangle newDestinationXOnly = new Rectangle(Destination.X, old.Y, gameObject.Width, gameObject.Height);
                    Rectangle newDestinationYOnly = new Rectangle(old.X, Destination.Y, gameObject.Width, gameObject.Height);
                    if (newDestinationXOnly.Intersects(tile.Destination))
                    {
                        Destination.X = old.X;
                    }

                    if (newDestinationYOnly.Intersects(tile.Destination))
                    {

                        Destination.Y = old.Y;

                        if (gameObject.Center.Y < tile.Destination.Y)
                        {
                            gameObject.IsJumping = false;
                            gameObject.CurrentSpeed = 0;
                        }
                    }
                }
            }

            return Destination;
        }
开发者ID:Vergilreborn,项目名称:LunarIllusions,代码行数:30,代码来源:CollisionDetector.cs


示例6: addMapObject

        public void addMapObject(MapObject mapObject)
        {
            if (this.mapObjects == null)
                this.mapObjects = new List<MapObject>();

            this.mapObjects.Add(mapObject);
        }
开发者ID:BigWeather,项目名称:OSDC,代码行数:7,代码来源:MapTile.cs


示例7: AddObjectClone

 public void AddObjectClone(MapObject obj)
 {
     MapObject o = (MapObject)obj.Clone();
     o.MapX %= 2 * (Config.BigTileEdgeSize + 1);
     o.MapY %= 2 * (Config.BigTileEdgeSize + 1);
     Objects.Add(o);
 }
开发者ID:SnakeSolidNL,项目名称:tools,代码行数:7,代码来源:BigTile.cs


示例8: ObjectWrapper

        public ObjectWrapper(MapObject mapObject, Point index)
        {
            _object = mapObject;
            _index = index;

            DrawPrioirty = _index.X * 1000 + _index.Y;
            IsDrawable = true;
        }
开发者ID:ktj007,项目名称:Lz,代码行数:8,代码来源:ObjectWrapper.cs


示例9: TestMoveUp

        public void TestMoveUp()
        {
            var movableObject = new MapObject {Position = new MapPosition(5, 7)};

            movableObject.Position = new MapPosition(movableObject.Position, new PositionChange {Y = 1});

            Assert.AreEqual(new MapPosition(5, 8), movableObject.Position);
        }
开发者ID:Ziretech,项目名称:Ubiq,代码行数:8,代码来源:MapObjectTest.cs


示例10: TestMoveRight

        public void TestMoveRight()
        {
            var movableObject = new MapObject {Position = new MapPosition(6, 2)};

            movableObject.Position = new MapPosition(movableObject.Position, new PositionChange{X = 1});

            Assert.AreEqual(new MapPosition(7, 2), movableObject.Position);
        }
开发者ID:Ziretech,项目名称:Ubiq,代码行数:8,代码来源:MapObjectTest.cs


示例11: TestMoveLeft

        public void TestMoveLeft()
        {
            var movableObject = new MapObject {Position = new MapPosition(4, 4)};

            movableObject.Position = new MapPosition(movableObject.Position, new PositionChange {X = -1});

            Assert.AreEqual(new MapPosition(3, 4), movableObject.Position);
        }
开发者ID:Ziretech,项目名称:Ubiq,代码行数:8,代码来源:MapObjectTest.cs


示例12: TestMoveDown

        public void TestMoveDown()
        {
            var movableObject = new MapObject {Position = new MapPosition(8, 1)};

            movableObject.Position = new MapPosition(movableObject.Position, new PositionChange{Y = -1});

            Assert.AreEqual(new MapPosition(8, 0), movableObject.Position);
        }
开发者ID:Ziretech,项目名称:Ubiq,代码行数:8,代码来源:MapObjectTest.cs


示例13: TestAddOneMovableObject

        public void TestAddOneMovableObject()
        {
            var map = new Map();
            var movableObject = new MapObject();
            map.AddObject(movableObject);

            Assert.AreEqual(1, map.GetNumDrawables());
            Assert.AreEqual(movableObject, map.GetDrawable(0));
        }
开发者ID:Ziretech,项目名称:Ubiq,代码行数:9,代码来源:MapTest.cs


示例14: Map

 public Map(int mapSize)
 {
     this.mapSize = mapSize;
     this.map = new MapObject [mapSize][];
     for (int i = 0; i < map.Length; ++i)
     {
         map[i] = new MapObject[mapSize];
     }
 }
开发者ID:isuru-c,项目名称:thunder-tank,代码行数:9,代码来源:Map.cs


示例15: MapChangeRegion_ObjectIn

 void MapChangeRegion_ObjectIn( Entity entity, MapObject obj )
 {
     if( PlayerIntellect.Instance != null && PlayerIntellect.Instance.ControlledObject == obj )
     {
         PlayerCharacter.ChangeMapInformation playerCharacterInformation =
             ( (PlayerCharacter)PlayerIntellect.Instance.ControlledObject ).GetChangeMapInformation( this );
         GameWorld.Instance.SetShouldChangeMap( mapName, spawnPointName,
             playerCharacterInformation );
     }
 }
开发者ID:huytd,项目名称:fosproject,代码行数:10,代码来源:MapChangeRegion.cs


示例16: Pushed

        public override int Pushed(MapObject pusher, MirDirection dir, int distance)
        {
            int result = base.Pushed(pusher, dir, distance);

            if (result > 0)
            {
                if (pusher is PlayerObject) Attacked((PlayerObject)pusher, Math.Max(50, Envir.Random.Next((int)MaxHP)), DefenceType.Repulsion);
                else if (pusher is MonsterObject) Attacked((MonsterObject)pusher, Math.Max(50, Envir.Random.Next((int)MaxHP)), DefenceType.Repulsion);
            }
            return result;
        }
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:11,代码来源:ThunderElement.cs


示例17: HitsMapObject

		public static bool HitsMapObject(this Ray ray, MapObject obj, float maxDistance = 2048)
		{
			ray.Direction = ray.Direction.GetNormalize() * maxDistance;
			RayCastResult[] piercingResult = PhysicsWorld.Instance.RayCastPiercing(ray, (int)ContactGroup.CastAll);
			foreach (var res in piercingResult)
			{
				if (res.Distance < maxDistance && res.Shape.Body._InternalUserData != null && res.Shape.Body._InternalUserData == obj)
					return true;
			}
			return false;
		}
开发者ID:Orvid,项目名称:NeoAxis.UI,代码行数:11,代码来源:RayExtensions.cs


示例18: TestBlockingObjectCanShareCoordinateWithNonBlocking

        public void TestBlockingObjectCanShareCoordinateWithNonBlocking()
        {
            var map = new Map();
            var blockingObject = new MapObject {Position = new MapPosition(4, 4)};
            var nonBlockingObject = new MapObject {Position = new MapPosition(4, 3), Blocking = false};
            map.AddObject(blockingObject);
            map.AddObject(nonBlockingObject);

            map.Move(blockingObject, new PositionChange {Y = -1});

            Assert.AreEqual(new MapPosition(4, 3), blockingObject.Position);
        }
开发者ID:Ziretech,项目名称:Ubiq,代码行数:12,代码来源:MapTest.cs


示例19: TestAddTwoMovableObjects

        public void TestAddTwoMovableObjects()
        {
            var map = new Map();
            var movableObject1 = new MapObject();
            map.AddObject(movableObject1);
            var movableObject2 = new MapObject();
            map.AddObject(movableObject2);

            Assert.AreEqual(2, map.GetNumDrawables());
            Assert.AreEqual(movableObject1, map.GetDrawable(0));
            Assert.AreEqual(movableObject2, map.GetDrawable(1));
        }
开发者ID:Ziretech,项目名称:Ubiq,代码行数:12,代码来源:MapTest.cs


示例20: registerNewLocation

 public void registerNewLocation(Vector2 coords, int number, string objType)
 {
     switch (objType) {
     case "City":
         if (cities[number] == null)
             cities[number] = new MapObject(coords, number, objType);
         break;
     case "Lab":
         if (labs[number] == null)
             labs[number] = new MapObject(coords, number, objType);
         break;
     }
 }
开发者ID:oguretsss,项目名称:par,代码行数:13,代码来源:LocationManager.cs



注:本文中的MapObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MapOverlay类代码示例发布时间:2022-05-24
下一篇:
C# MapLayer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap