public List <GridCell> GetCells(GridPos basePos, GridCardinals direction, int distance)
    {
        GridPos dir = GridPos.Zero;

        switch (direction)
        {
        case GridCardinals.FORWARD:
            dir = new GridPos(0, -1);
            break;

        case GridCardinals.BACKWARD:
            dir = new GridPos(0, 1);
            break;

        case GridCardinals.LEFT:
            dir = new GridPos(1, 0);
            break;

        case GridCardinals.RIGHT:
            dir = new GridPos(-1, 0);
            break;
        }

        List <GridCell> list = new List <GridCell>();

        int     count   = 0;
        GridPos cellPos = basePos;

        while (count < distance)
        {
            cellPos = basePos + dir * count;
            if (!IsValidGridPos(cellPos))
            {
                break;
            }
            list.Add(this.cells[cellPos.x, cellPos.z]);
            count++;
        }

        return(list);
    }
 public List <GridCell> GetCells(GridPos basePos, GridCardinals direction)
 {
     return(GetCells(basePos, direction, Mathf.Max(this.sizeX, this.sizeZ)));
 }