Esempio n. 1
0
    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);
    }
Esempio n. 2
0
 public List <T> Neighbours(T tile, RectNeighbors neighbor)
 {
     return(Neighbours(tile.index, neighbor));
 }
Esempio n. 3
0
 public List <T> Neighbours(int line, int column, RectNeighbors neighbor)
 {
     return(Neighbours(IndexOf(line, column), neighbor));
 }
Esempio n. 4
0
 public List <T> Neighbours(Vector3 position, RectNeighbors neighbor)
 {
     return(Neighbours(IndexOf(position), neighbor));
 }
Esempio n. 5
0
 public List <T> Neighbours(int index, RectNeighbors neighbor)
 {
     return(Neighbours(IndexOf(index), neighbor));
 }