public List <SelectableTile> GetNeighbouringFreeTiles(Vector2i coord, Vector2i neighbourCount) { var retList = new List <SelectableTile> (); for (int x = coord.X - neighbourCount.X - 1; x < coord.X + neighbourCount.X; x++) { for (int y = coord.Y - neighbourCount.Y - 1; y < coord.Y + neighbourCount.Y; y++) { if (x == coord.X && y == coord.Y) { continue; } var tile = cells.Get(new Vector2i(x, y)); if (tile && tile.Selectable) { retList.Add(tile); } } } return(retList); }
public Wall GetNeighbour(Vector2i coord, Direction direction) { if (direction == Direction.ABOVE) { return(wallList.Get(new Vector2i(coord.X, coord.Y + 1))); } else if (direction == Direction.BELOW) { return(wallList.Get(new Vector2i(coord.X, coord.Y - 1))); } else if (direction == Direction.LEFT) { return(wallList.Get(new Vector2i(coord.X - 1, coord.Y))); } else { return(wallList.Get(new Vector2i(coord.X + 1, coord.Y))); } }