protected void SetupNeighbours(IDictionary<Point, Tile> tilesPositions, IList<Tile> tiles)
{
foreach (var t in tiles)
{
Tile north = null;
Tile east = null;
Tile south = null;
Tile west = null;
var neighbours = new TileNeighbours();
if (tilesPositions.TryGetValue(t.GridPosition + new Point(0, -1), out north))
neighbours.North = north;
if (tilesPositions.TryGetValue(t.GridPosition + new Point(1, 0), out east))
neighbours.East = east;
if (tilesPositions.TryGetValue(t.GridPosition + new Point(0, 1), out south))
neighbours.South = south;
if (tilesPositions.TryGetValue(t.GridPosition + new Point(-1, 0), out west))
neighbours.West = west;
t.Neighbours = neighbours;
}
}
}