1
Fork 0
mirror of https://github.com/Steffo99/octogem.git synced 2024-10-16 20:17:26 +00:00
octogem/Assets/Scripts/Structures/MapPosition.cs
2018-09-27 00:38:49 +02:00

24 lines
No EOL
453 B
C#

using UnityEngine;
[System.Serializable]
public class MapPosition : System.Object
{
public readonly int x;
public readonly int y;
public MapPosition(int x, int y)
{
this.x = x;
this.y = y;
}
public int Distance(MapPosition other)
{
return (Mathf.Abs(x - other.x) + Mathf.Abs(y - other.y));
}
public bool IsAdjacent(MapPosition other)
{
return (Distance(other) == 1);
}
}