Example #1
0
        public List <TDTile> GetAdjacentTiles(TDTile tile)
        {
            List <TDTile> adjacent = new List <TDTile> ();

            int tileX = tile.GetX();
            int tileY = tile.GetY();

            if (tileX > 0)
            {
                adjacent.Add(_tiles[tileX - 1, tileY]);
            }

            if (tileX < _width - 1)
            {
                adjacent.Add(_tiles[tileX + 1, tileY]);
            }

            if (tileY > 0)
            {
                adjacent.Add(_tiles[tileX, tileY - 1]);
            }

            if (tileY < _height - 1)
            {
                adjacent.Add(_tiles[tileX, tileY + 1]);
            }

            return(adjacent);
        }
Example #2
0
 public bool Equals(TDTile other)
 {
     return(other != null &&
            other.GetX() == x &&
            other.GetY() == y &&
            other.type == type);
 }