Exemple #1
0
 /// <summary>
 /// Method to replace tile
 /// </summary>
 /// <param name="x">X position (in array)</param>
 /// <param name="y">Y position (in array)</param>
 /// <param name="Tile">New tile</param>
 public void SetTile(int x, int y, Tile Tile)
 {
     tiles[x, y] = Tile;
 }
 // setting a tile's type
 void SetCell(int x, int y, Tile celltype)
 {
     this._dungeonMap[x + this._xsize * y] = celltype;
 }
Exemple #3
0
        /// <summary>
        /// Check if tile is surrounded with wall tiles
        /// </summary>
        /// <param name="t">Tile to check</param>
        /// <returns>True if surrounded.</returns>
        public bool CheckIsolation(Tile t)
        {
            if (t.position.X > 0 && t.position.Y > 0 && t.position.X < (map.GetSize()-1) * map.GetTileSize() && t.position.Y < (map.GetSize()-1) * map.GetTileSize())
            {
                int x = t.position.X / map.GetTileSize();
                int y = t.position.Y / map.GetTileSize();

                t.Isolated = tiles[x, y].isSolid && tiles[x - 1, y].isSolid && tiles[x + 1, y].isSolid && tiles[x, y - 1].isSolid && tiles[x, y + 1].isSolid &&
                                                    tiles[x - 1, y - 1].isSolid && tiles[x - 1, y + 1].isSolid && tiles[x + 1, y - 1].isSolid && tiles[x + 1, y + 1].isSolid;

                if (t.Isolated) t = null;
                return true;
            }
            return false;
        }