public static Player Load(PlayerSave playerSave) { Player player = GameManager.Instance.gameObject.AddComponent <Player>(); //TO DO player.Class = playerSave.Class; player.Experience = playerSave.Experience; player.Inventory = InventorySave.Load(playerSave.Inventory); player.Money = playerSave.Money; player.Quests = new List <Quest>(); foreach (QuestSave questSave in playerSave.Quests) { player.Quests.Add(QuestSave.Load(questSave)); } player.levelStatsUp = playerSave.levelStatsUp; player.Health = playerSave.Health; player.Mana = playerSave.Mana; player.Level = playerSave.Level; player.Name = playerSave.Name; player.Spells = new List <Spell>(); foreach (SpellSave spellSave in playerSave.Spells) { player.Spells.Add(SpellSave.Load(spellSave)); } player.Stats = playerSave.Stats; player.MaxHealth = playerSave.MaxHealth; player.MaxMana = playerSave.MaxMana; return(player); }
public static PlayerSave Save(Player player) { PlayerSave save = new PlayerSave(); save.Name = player.name; save.Stats = player.Stats; save.Health = player.Health; save.Mana = player.Mana; save.MaxHealth = player.MaxHealth; save.MaxMana = player.MaxMana; save.Spells = new List <SpellSave>(); foreach (Spell spell in player.Spells) { save.Spells.Add(SpellSave.Save(spell)); } save.Level = player.Level; save.Class = player.Class; save.Inventory = InventorySave.Save(player.Inventory); save.Experience = player.Experience; save.Money = player.Money; save.levelStatsUp = player.levelStatsUp; save.Quests = new List <QuestSave>(); foreach (Quest quest in player.Quests) { save.Quests.Add(QuestSave.Save(quest)); } return(save); }
public static QuestSave Save(Quest quest) { QuestSave questSave = new QuestSave(); questSave.Name = quest.Name; questSave.Summary = quest.Summary; questSave.Story = new List <Dialogue>(quest.Story); questSave.MoneyReward = quest.MoneyReward; questSave.ExperienceReward = quest.ExperienceReward; questSave.QuestGoal = quest.QuestGoal; return(questSave); }
public static Quest Load(QuestSave save) { Quest quest = ScriptableObject.CreateInstance <Quest>(); quest.Name = save.Name; quest.Summary = save.Summary; quest.Story = new List <Dialogue>(save.Story); quest.MoneyReward = save.MoneyReward; quest.ExperienceReward = save.ExperienceReward; quest.QuestGoal = save.QuestGoal; return(quest); }