示例#1
0
        /// <summary>
        /// Creates a new save game data.
        /// </summary>
        /// <param name="playerName">New player's name.</param>
        /// <param name="monsterChoice">New player's choice of starting monster.</param>
        public static void NewGameData(string playerName, string monsterChoice)
        {
            // Create a new player and place it in the starting spot.
            _playerData = new PlayerData(playerName, "World.Fornwest.Main", new[] { 1, 1 });

            // Create the starter monster and add it to the party.
            var monsterBase    = Resources.Load <MonsterBase>($"Monsters/{monsterChoice}");
            var starterMonster = new MonsterObj(monsterBase, 5);

            _partyMonsters.Clear();
            _partyMonsters.Add(starterMonster.SaveMonsterData());

            // Data is ready so now we signal the new game.
            GameSignals.GAME_NEW.Dispatch(_playerData.id);
            Debug.Log($"New game: {_playerData.id} created.");
        }