예제 #1
0
        public static PatchCoordinates FromTile(TileCoordinates tileCoordinates)
        {
            var coordinates = new PatchCoordinates()
            {
                X = tileCoordinates.X / PatchWidth,
                Y = tileCoordinates.Y / PatchHeight
            };

            if (tileCoordinates.X < 0)
            {
                coordinates.X--;
            }

            if (tileCoordinates.Y < 0)
            {
                coordinates.Y--;
            }

            return(coordinates);
        }
예제 #2
0
파일: Tile.cs 프로젝트: Tichau/LudumDare46
 /// <summary>
 /// Distance from another tile in manhattan distance.
 /// </summary>
 /// <param name="other">The other tile.</param>
 /// <returns>Returns the distance from the other tile.</returns>
 public int DistanceFrom(TileCoordinates other)
 {
     return(Mathf.Abs(this.X - other.X) + Mathf.Abs(this.Y - other.Y));
 }