Exemplo n.º 1
0
        public Level(LevelSaveSummary summary)
        {
            _levelId   = summary.LevelId;
            _levelName = summary.LevelName;

            _mapWidth  = summary.Width;
            _mapHeight = summary.Height;

            _tileInformation = new Dictionary <int, MapTileDetails>();
            _tileGrid        = summary.Tiles;
            foreach (KeyValuePair <int, TileType> tile in summary.TileTypes)
            {
                _tileInformation[tile.Key] = Entities.EntityFactory.CreateMapTile(tile.Value);
            }
            _revealed = summary.Revealed;

            _furnishings = new SortedDictionary <int, Furnishing>();
            foreach (KeyValuePair <int, int> furnishing in summary.Furnishings)
            {
                _furnishings[furnishing.Key] = Furnishing.GetFurnishing(furnishing.Value);
            }

            _actors = new SortedDictionary <int, Actor>();
            foreach (KeyValuePair <int, int> actor in summary.Actors)
            {
                _actors[actor.Key] = Actor.GetActor(actor.Value);
            }
        }
Exemplo n.º 2
0
        // Save game related stuff
        public LevelSaveSummary GetSaveDetails()
        {
            var summary = new LevelSaveSummary();

            summary.LevelId   = _levelId;
            summary.LevelName = _levelName;
            summary.Height    = _mapHeight;
            summary.Width     = _mapWidth;

            summary.Tiles = _tileGrid;
            foreach (KeyValuePair <int, MapTileDetails> tile in _tileInformation)
            {
                summary.TileTypes[tile.Key] = tile.Value.TileType;
            }
            summary.Revealed = _revealed;

            foreach (KeyValuePair <int, Furnishing> furnishing in _furnishings)
            {
                summary.Furnishings[furnishing.Key] = furnishing.Value.FurnishingId;
            }
            foreach (KeyValuePair <int, Actor> actor in _actors)
            {
                summary.Actors[actor.Key] = actor.Value.ActorId;
            }

            return(summary);
        }