public List <T> Neighbours(TileIndex index, RectNeighbors neighbor) { List <T> ret = new List <T>(); int i = 0; int count = Directions.Length; if (neighbor == RectNeighbors.Edge) { count = 4; } else if (neighbor == RectNeighbors.Corner) { i = 4; } for (i = 0; i < count; i++) { var tile = DirectionTo(index, (RectDirection)i, 1); if (tile != null) { ret.Add(tile); } } return(ret); }
public List <T> Neighbours(T tile, RectNeighbors neighbor) { return(Neighbours(tile.index, neighbor)); }
public List <T> Neighbours(int line, int column, RectNeighbors neighbor) { return(Neighbours(IndexOf(line, column), neighbor)); }
public List <T> Neighbours(Vector3 position, RectNeighbors neighbor) { return(Neighbours(IndexOf(position), neighbor)); }
public List <T> Neighbours(int index, RectNeighbors neighbor) { return(Neighbours(IndexOf(index), neighbor)); }