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


C# IMap.GetTile方法代码示例

本文整理汇总了C#中IMap.GetTile方法的典型用法代码示例。如果您正苦于以下问题:C# IMap.GetTile方法的具体用法?C# IMap.GetTile怎么用?C# IMap.GetTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMap的用法示例。


在下文中一共展示了IMap.GetTile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Collide

        public static bool Collide(Point destination, IMap map)
        {
            bool IsColliding = false;

            ITile tile = map.GetTile(destination);

            IsColliding = tile.IsBlocked;

            return IsColliding;
        }
开发者ID:milesgray,项目名称:resatiate,代码行数:10,代码来源:CollisionEngine.cs

示例2: FindNeighbors

        public void FindNeighbors(IMap map)
        {
            Tile nullTile = new Tile();
            Point[] coordinates = new Point[8];
            Directions[] directionArray = new Directions[8];
            int adjustedSize = this.rectangle.Width;   // size is distance from center to edge,
            // double to ensure we end up outside of this box

            directionArray[(int)Directions.East] = Directions.East;
            directionArray[(int)Directions.North] = Directions.North;
            directionArray[(int)Directions.NorthEast] = Directions.NorthEast;
            directionArray[(int)Directions.NorthWest] = Directions.NorthWest;
            directionArray[(int)Directions.South] = Directions.South;
            directionArray[(int)Directions.SouthEast] = Directions.SouthEast;
            directionArray[(int)Directions.SouthWest] = Directions.SouthWest;
            directionArray[(int)Directions.West] = Directions.West;

            coordinates[(int)Directions.East] = new Point(this.rectangle.Center.X + adjustedSize, this.rectangle.Center.Y);
            coordinates[(int)Directions.North] = new Point(this.rectangle.Center.X, this.rectangle.Center.Y - adjustedSize);
            coordinates[(int)Directions.NorthEast] = new Point(this.rectangle.Center.X + adjustedSize, this.rectangle.Center.Y - adjustedSize);
            coordinates[(int)Directions.NorthWest] = new Point(this.rectangle.Center.X - adjustedSize, this.rectangle.Center.Y - adjustedSize);
            coordinates[(int)Directions.South] = new Point(this.rectangle.Center.X, this.rectangle.Center.Y + adjustedSize);
            coordinates[(int)Directions.SouthEast] = new Point(this.rectangle.Center.X + adjustedSize, this.rectangle.Center.Y + adjustedSize);
            coordinates[(int)Directions.SouthWest] = new Point(this.rectangle.Center.X - adjustedSize, this.rectangle.Center.Y + adjustedSize);
            coordinates[(int)Directions.West] = new Point(this.rectangle.Center.X - adjustedSize, this.rectangle.Center.Y);

            foreach (Directions d in directionArray)
            {
                this.adjacentTiles[(int)d] = map.GetTile(coordinates[(int)d]);
            }
        }
开发者ID:milesgray,项目名称:resatiate,代码行数:31,代码来源:Tile.cs


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