コード例 #1
0
        static void SetupNewGame(UserData.GameData newGameData)
        {
            // TODO: Check whether anything else needs to go in here too.
            _topLevelRNG = new RandomNumberGenerator(newGameData.GameID);
            _combatRNG   = new RandomNumberGenerator(_topLevelRNG.GetRandomInteger());
            _lootRNG     = new RandomNumberGenerator(_topLevelRNG.GetRandomInteger());
            _miscRNG     = new RandomNumberGenerator(_topLevelRNG.GetRandomInteger());

            _player   = new Entities.Player.Player(newGameData);
            _gameData = newGameData;

            // TODO: Create achievement Dictionary etc here.
            Quests.GameEventManager.SetupGameEventHandling();
        }
コード例 #2
0
        public static void LoadGame(UserData.SaveGame gameState)
        {
            _topLevelRNG = new RandomNumberGenerator(gameState.TopLevelRNG);
            _combatRNG   = new RandomNumberGenerator(gameState.CombatRNG);
            _lootRNG     = new RandomNumberGenerator(gameState.LootRNG);
            _miscRNG     = new RandomNumberGenerator(gameState.MiscRNG);

            _gameData    = gameState.Summary.GameData;
            _currentTime = gameState.CurrentTime;
            _player      = gameState.Player;
            Entities.Player.Player.SetPlayer(_player);

            Entities.Furnishings.Furnishing.LoadSaveData(gameState.Furnishings);
            Entities.Monsters.Monster.LoadSaveData(gameState.Monsters);

            foreach (KeyValuePair <Levels.LevelId, Levels.LevelSaveSummary> level in gameState.Levels)
            {
                _levels[level.Key] = new Levels.Level(level.Value);
            }

            _currentLevel = _levels[gameState.CurrentLevelId];

            Quests.GameEventManager.LoadData(gameState);
        }