Exemple #1
0
 public Wall(Vector2 position, LinkedSpriteType type)
 {
     Position     = position;
     Type         = type;
     IsDestructed = false;
     HasNeighbor  = false;
     Visible      = false;
 }
Exemple #2
0
        /// <summary>
        /// Adds a wall.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="tile">The tile where the wall will be positioned on.</param>
        public static void AddWall(LinkedSpriteType type, Tile tile)
        {
            // If the tile already hasn't an object and if the wall object doesn't already exists
            if (!_wallObjects.ContainsKey(tile.Position))
            {
                if (tile.Flora == null) // TODO: Add/Check other objects
                {
                    // Create a new wall object and set it to the tile's position and pass the wall type
                    Wall wall = new Wall(tile.Position, type);

                    // Tile is occupied now
                    tile.IsOccupied = true;
                    // Pass the wall object to the tile
                    tile.Wall         = wall;
                    tile.Blueprint    = null;
                    tile.Enterability = EnterabilityType.Never;

                    // Add the wall object to the dictionary
                    _wallObjects.Add(tile.Position, wall);

                    ResetGraph();
                }
            }
        }