当前位置: 首页>>代码示例>>C#>>正文


C# MapObject类代码示例

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


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


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