예제 #1
0
        // determine which enhanced map tiles are active (within range of the camera)
        // if enhanced map tile is currently active and was also active last frame, nothing special happens and enhanced map tile is included in active list
        // if enhanced map tile is currently active but last frame was inactive, it will have its status set to active and enhanced map tile is included in active list
        // if enhanced map tile is currently inactive but last frame was active, it will have its status set to inactive, have its initialize method called if its respawnable
        //      (which will set it back up to its default state), and not include it in the active list
        //      next time a respawnable enemy is determined active, since it was reset back to default state upon going inactive, it will essentially be "respawned" in its starting state
        // if enhanced map tile is currently set to REMOVED, it is permanently removed from the map's list of enemies and will never be able to be active again
        private List <EnhancedMapTile> LoadActiveEnhancedMapTiles()
        {
            List <EnhancedMapTile> activeEnhancedMapTiles = new List <EnhancedMapTile>();

            for (int i = map.GetEnhancedMapTiles().Count - 1; i >= 0; i--)
            {
                EnhancedMapTile enhancedMapTile = map.GetEnhancedMapTiles()[i];

                if (IsMapEntityActive(enhancedMapTile))
                {
                    activeEnhancedMapTiles.Add(enhancedMapTile);
                    if (enhancedMapTile.MapEntityStatus == MapEntityStatus.INACTIVE)
                    {
                        enhancedMapTile.MapEntityStatus = MapEntityStatus.ACTIVE;
                    }
                }
                else if (enhancedMapTile.MapEntityStatus == MapEntityStatus.ACTIVE)
                {
                    enhancedMapTile.MapEntityStatus = MapEntityStatus.INACTIVE;
                    if (enhancedMapTile.IsRespawnable)
                    {
                        enhancedMapTile.Initialize();
                    }
                }
                else if (enhancedMapTile.MapEntityStatus == MapEntityStatus.REMOVED)
                {
                    map.GetEnhancedMapTiles().RemoveAt(i);
                }
            }
            return(activeEnhancedMapTiles);
        }
예제 #2
0
 // add an enhanced map tile to the map's list of enhanced map tiles
 public void AddEnhancedMapTile(EnhancedMapTile enhancedMapTile)
 {
     enhancedMapTile.SetMap(this);
     this.enhancedMapTiles.Add(enhancedMapTile);
 }