Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public static Inventory Load(InventorySave save)
        {
            Inventory inventory = new Inventory();

            inventory.Items = new List <Item>();
            foreach (ItemSave itemSave in save.Items)
            {
                inventory.Items.Add(ItemSave.Load(itemSave));
            }
            inventory.EquippedItems = EquippedItemsSave.Load(save.EquippedItems);
            return(inventory);
        }
Ejemplo n.º 4
0
        public static InventorySave Save(Inventory inventory)
        {
            InventorySave inventorySave = new InventorySave();

            inventorySave.Items = new List <ItemSave>();
            foreach (Item item in inventory.Items)
            {
                inventorySave.Items.Add(ItemSave.Save(item));
            }

            inventorySave.EquippedItems = EquippedItemsSave.Save(inventory.EquippedItems);

            return(inventorySave);
        }