public static GameManagerData Load(GameManagerSave save) { GameManagerData gameManager = new GameManagerData(); gameManager.player = PlayerSave.Load(save.PlayerSave); gameManager.enemies = new List <Mob>(); foreach (EnemySave enemySave in save.EnemiesSave) { gameManager.enemies.Add(EnemySave.Load(enemySave)); } gameManager.enemyAttacked = save.EnemyAttacked; return(gameManager); }
public static GameManagerSave Save(GameManager gameManager) { GameManagerSave save = new GameManagerSave(); save.PlayerSave = PlayerSave.Save(gameManager.player); save.EnemiesSave = new List <EnemySave>(); foreach (Mob enemy in gameManager.enemies) { save.EnemiesSave.Add(EnemySave.Save(enemy)); } save.EnemyAttacked = Int32.MaxValue; return(save); }
public static Mob Load(EnemySave enemySave) { Mob enemy = GameManager.Instance.gameObject.AddComponent <Mob>(); enemy.Name = enemySave.Name; enemy.difficulty = enemySave.Difficulty; enemy.Stats = enemySave.Stats; enemy.Health = enemySave.Health; enemy.Mana = enemySave.Mana; enemy.Spells = new List <Spell>(); foreach (SpellSave spellSave in enemySave.Spells) { enemy.Spells.Add(SpellSave.Load(spellSave)); } enemy.Level = enemySave.Level; enemy.MaxHealth = enemySave.MaxHealth; enemy.MaxMana = enemySave.MaxMana; return(enemy); }
public static EnemySave Save(Mob enemy) { EnemySave save = new EnemySave(); save.Difficulty = enemy.difficulty; save.Name = enemy.name; save.Stats = enemy.Stats; save.Health = enemy.Health; save.Mana = enemy.Mana; save.MaxHealth = enemy.MaxHealth; save.MaxMana = enemy.MaxMana; save.Spells = new List <SpellSave>(); foreach (Spell spell in enemy.Spells) { save.Spells.Add(SpellSave.Save(spell)); } save.Level = enemy.Level; return(save); }