private bool IsSpawnPoint(HashSet <Location> spawns, Location location, MapSize size) { if (!IsNearBorder(location, size)) { return(spawns.Contains(location.AboveDiagonal(size))); } if (location.X >= size.X / 2.0) { return(spawns.Contains(location)); } return(location.AboveDiagonal(size) == location ? false : spawns.Contains(location.AboveDiagonal(size))); }
public TLabel this[Location location] { get { return(labels .Argmin(kv => kv.Value.ManhattanDistance(location.AboveDiagonal(size))) .Key); } }
private bool IsNearBorder(Location location, MapSize size) { return(location.AboveDiagonal(size).ManhattanDistance(Location.Zero) > size.X - 2); }