Exemplo n.º 1
0
        // On utilise les valeurs qu'on a sauver pour re générer les joueurs 
        // Bon le Load c'est un peu n'importe quoi ça fait beaucoup de chose, à refactor peut etre
        public void LoadPartyData(PlayerDatabase database, GameVariableDatabase variableDatabase, GameVariableDatabase chestDatabase, ItemDatabase itemDatabase)
        {
            variableDatabase.LoadVariable(gameVariables);
            chestDatabase.LoadVariable(chestVariable);
            characterStatControllers.Clear();
            characterGrowths.Clear();
            characterEquipement.Clear();
            for (int i = 0; i < characterSavesData.Count; i++)
            {
                PlayerData playerData = database.GetPlayerData(characterSavesData[i].playerDataID);
                characterStatControllers.Add(new CharacterStatController(playerData.CharacterData));
                characterGrowths.Add(new CharacterGrowthController(playerData.CharacterGrowth, characterStatControllers[i]));

                // Convertit les string du json en ArmorData
                List<ArmorData> res = new List<ArmorData>(characterSavesData[i].armorEquipped.Count);
                for (int j = 0; j < characterSavesData[i].armorEquipped.Count; j++)
                {
                    res.Add((ArmorData) itemDatabase.GetItemData(characterSavesData[i].armorEquipped[j]));
                }
                characterEquipement.Add(new CharacterEquipementController(playerData.WeaponEquipped, res, playerData.WeaponLevels, characterSavesData[i].playerExperience, characterStatControllers[i], characterGrowths[i]));

            }
            partyInitialized = new PartyInitialized();
        }