本文整理汇总了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;
}
示例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]);
}
}