Ejemplo n.º 1
0
    /// <summary>Loads inventory data for items and money</summary>
    /// <param name="saveData_">The PartySaveData reference that holds the item and money data we need to store</param>
    public void LoadPartyFromSave(PartySaveData saveData_)
    {
        //Saving the money
        this.money = saveData_.money;

        //Looping through all of the inventory slot objects in the save data
        this.itemSlots = new List <Item>();
        for (int i = 0; i < saveData_.inventorySlots.Count; ++i)
        {
            //If the current item is emtpy, we add an empty slot
            if (saveData_.inventorySlots[i] == "")
            {
                this.itemSlots.Add(null);
            }
            //If the current item isn't empty, we add it's item component to our inventory
            else
            {
                PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.inventorySlots[i], typeof(PrefabIDTagData)) as PrefabIDTagData;
                GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.iDNumber));

                itemObj.transform.SetParent(this.transform);
                this.itemSlots.Add(itemObj.GetComponent <Item>());
            }
        }
        for (int s = 0; s < saveData_.stackedItems.Count; ++s)
        {
            //Making sure the item in this item stack matches the same item in the
            //Getting the stack data
            InventoryItemStackData stackData  = JsonUtility.FromJson(saveData_.stackedItems[s], typeof(InventoryItemStackData)) as InventoryItemStackData;
            GameObject             stackedObj = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(stackData.iDNumber));

            //Making sure the stacked object is actually an item
            if (stackedObj.GetComponent <Item>())
            {
                //Making sure the item in this stack matches the item in the designated inventory index
                if (stackData.itemStackIndex < this.itemSlots.Count &&
                    this.itemSlots[stackData.itemStackIndex].GetComponent <IDTag>().numberID == stackData.iDNumber)
                {
                    //Looping through every item that's in this stack
                    for (int si = 0; si < stackData.numberOfItemsInStack; ++si)
                    {
                        //Creating a new instance of the stacked item
                        GameObject stackedItem = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(stackData.iDNumber));
                        //Parenting the stacked item to the one that's in the inventory slot
                        stackedItem.transform.SetParent(this.itemSlots[stackData.itemStackIndex].transform);
                        //Increasing the stack size count in the inventory slot
                        this.itemSlots[stackData.itemStackIndex].currentStackSize += 1;

                        //If the inventory slot has reached the max stack size, we stop
                        if (this.itemSlots[stackData.itemStackIndex].currentStackSize >= this.itemSlots[stackData.itemStackIndex].maxStackSize)
                        {
                            break;
                        }
                    }
                }
            }
        }
    }
    //Constructor for this class
    public CharacterSaveData(Character characterToSave_)
    {
        //Setting variables from Character.cs
        this.charName  = characterToSave_.charName;
        this.className = characterToSave_.className;

        //Setting variables from RaceTypes.cs
        this.race        = characterToSave_.charRaceTypes.race;
        this.subtypeList = characterToSave_.charRaceTypes.subtypeList;

        //Setting variables from Skills.cs
        this.strength      = characterToSave_.charSkills.GetSkillStatLevelValue(SkillStats.Strength);
        this.finesse       = characterToSave_.charSkills.GetSkillStatLevelValue(SkillStats.Finesse);
        this.willpower     = characterToSave_.charSkills.GetSkillStatLevelValue(SkillStats.Willpower);
        this.spirit        = characterToSave_.charSkills.GetSkillStatLevelValue(SkillStats.Spirit);
        this.unarmed       = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Unarmed);
        this.daggers       = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Daggers);
        this.swords        = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Swords);
        this.mauls         = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Mauls);
        this.poles         = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Poles);
        this.bows          = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Bows);
        this.shields       = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Shields);
        this.arcaneMagic   = characterToSave_.charSkills.GetSkillLevelValue(SkillList.ArcaneMagic);
        this.enchantMagic  = characterToSave_.charSkills.GetSkillLevelValue(SkillList.EnchantMagic);
        this.holyMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.HolyMagic);
        this.darkMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.DarkMagic);
        this.fireMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.FireMagic);
        this.waterMagic    = characterToSave_.charSkills.GetSkillLevelValue(SkillList.WaterMagic);
        this.windMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.WindMagic);
        this.electricMagic = characterToSave_.charSkills.GetSkillLevelValue(SkillList.ElectricMagic);
        this.stoneMagic    = characterToSave_.charSkills.GetSkillLevelValue(SkillList.StoneMagic);

        //Setting variables from PhysicalState.cs
        this.maxHP           = characterToSave_.charPhysState.maxHealth;
        this.currentHP       = characterToSave_.charPhysState.currentHealth;
        this.corruptionLevel = characterToSave_.charPhysState.corruptionLevel;

        //Setting variables from CombatStats.cs
        this.currentInitiativeSpeed = characterToSave_.charCombatStats.currentInitiativeSpeed;
        this.startingCol            = characterToSave_.charCombatStats.startingPositionCol;
        this.startingRow            = characterToSave_.charCombatStats.startingPositionRow;
        this.accuracy = characterToSave_.charCombatStats.accuracy;
        this.evasion  = characterToSave_.charCombatStats.evasion;

        this.combatEffects = new List <string>();
        for (int ce = 0; ce < characterToSave_.charCombatStats.combatEffects.Count; ++ce)
        {
            this.combatEffects.Add(JsonUtility.ToJson(characterToSave_.charCombatStats.combatEffects[ce]));
        }

        //Setting variables from ActionList.cs
        PrefabIDTagData actionIDData;

        if (characterToSave_.charActionList.actionSlot1 != null)
        {
            actionIDData = new PrefabIDTagData(characterToSave_.charActionList.actionSlot1.GetComponent <IDTag>());
            this.action1 = JsonUtility.ToJson(actionIDData);
        }
        if (characterToSave_.charActionList.actionSlot2 != null)
        {
            actionIDData = new PrefabIDTagData(characterToSave_.charActionList.actionSlot2.GetComponent <IDTag>());
            this.action2 = JsonUtility.ToJson(actionIDData);
        }
        if (characterToSave_.charActionList.actionSlot3 != null)
        {
            actionIDData = new PrefabIDTagData(characterToSave_.charActionList.actionSlot3.GetComponent <IDTag>());
            this.action3 = JsonUtility.ToJson(actionIDData);
        }
        if (characterToSave_.charActionList.actionSlot4 != null)
        {
            actionIDData = new PrefabIDTagData(characterToSave_.charActionList.actionSlot4.GetComponent <IDTag>());
            this.action4 = JsonUtility.ToJson(actionIDData);
        }
        if (characterToSave_.charActionList.actionSlot5 != null)
        {
            actionIDData = new PrefabIDTagData(characterToSave_.charActionList.actionSlot5.GetComponent <IDTag>());
            this.action5 = JsonUtility.ToJson(actionIDData);
        }
        if (characterToSave_.charActionList.ultimateAction != null)
        {
            actionIDData        = new PrefabIDTagData(characterToSave_.charActionList.ultimateAction.GetComponent <IDTag>());
            this.ultimateAction = JsonUtility.ToJson(actionIDData);
        }

        this.rechargingSpells = new List <string>();
        for (int rs = 0; rs < characterToSave_.charActionList.rechargingSpells.Count; ++rs)
        {
            this.rechargingSpells.Add(JsonUtility.ToJson(characterToSave_.charActionList.rechargingSpells[rs]));
        }

        //Setting all of the equipped object references
        if (characterToSave_.charEquipment.helm != null)
        {
            this.helmObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charEquipment.helm.GetComponent <IDTag>()));
        }
        if (characterToSave_.charEquipment.body != null)
        {
            this.chestObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charEquipment.body.GetComponent <IDTag>()));
        }
        if (characterToSave_.charEquipment.trinket != null)
        {
            this.trinketObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charEquipment.trinket.GetComponent <IDTag>()));
        }

        if (characterToSave_.charEquipment.leftHand != null)
        {
            this.leftHandObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charEquipment.leftHand.GetComponent <IDTag>()));
        }
        if (characterToSave_.charEquipment.rightHand != null)
        {
            this.rightHandObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charEquipment.rightHand.GetComponent <IDTag>()));
        }

        //Looping through all of the character perks to save their object references
        this.perkNames = new List <string>();
        for (int p = 0; p < characterToSave_.charPerks.allPerks.Count; ++p)
        {
            //Making sure the current perk isn't null
            if (characterToSave_.charPerks.allPerks[p] != null)
            {
                //Saving this perk's ID tag info
                this.perkNames.Add(JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charPerks.allPerks[p].GetComponent <IDTag>())));
            }
        }

        //Setting variables from LevelTracker.cs
        this.level            = characterToSave_.levelTracker.level;
        this.exp              = characterToSave_.levelTracker.currentEXP;
        this.healthCurve      = characterToSave_.levelTracker.defaultHealthCurve;
        this.healthCurveMod   = characterToSave_.levelTracker.healthCurveMod;
        this.combatsWonLevel  = characterToSave_.levelTracker.combatsWonLevel;
        this.spacesMovedLevel = characterToSave_.levelTracker.spacesMovedLevel;
        this.damageDealtLevel = characterToSave_.levelTracker.damageDealtLevel;
        this.damageTakenLevel = characterToSave_.levelTracker.damageTakenLevel;
        this.skillsUsedLevel  = characterToSave_.levelTracker.skillsUsedLevel;
        this.armorValuesLevel = characterToSave_.levelTracker.armorValuesLevel;
        this.healthAvgLevel   = characterToSave_.levelTracker.healthAvgLevel;

        this.combatsWonLifetime  = characterToSave_.levelTracker.combatsWonLifetime;
        this.spacesMovedLifetime = characterToSave_.levelTracker.spacesMovedLifetime;
        this.damageDealtLifetime = characterToSave_.levelTracker.damageDealtLifetime;
        this.damageTakenLifetime = characterToSave_.levelTracker.damageTakenLifetime;
        this.skillsUsedLifetime  = characterToSave_.levelTracker.skillsUsedLifetime;
        this.armorValuesLifetime = characterToSave_.levelTracker.armorValuesLifetime;
        this.healthAvgLifetime   = characterToSave_.levelTracker.healthAvgLifetime;
    }
Ejemplo n.º 3
0
    //Function called externally from SaveLoadManager.cs to load this character's component data
    public void LoadCharacterFromSave(CharacterSaveData saveData_)
    {
        //Setting the Character.cs variables
        this.firstName = saveData_.firstName;
        this.lastName  = saveData_.lastName;
        this.sex       = saveData_.sex;

        //Setting the RaceTypes.cs variables
        this.charRaceTypes.race        = saveData_.race;
        this.charRaceTypes.subtypeList = saveData_.subtypeList;

        //Setting all of the equipped items in Inventory.cs
        if (saveData_.helmObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.helmObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.helm = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.helm = null;
        }
        if (saveData_.chestObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.chestObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.chestPiece = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.chestPiece = null;
        }
        if (saveData_.legObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.legObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.leggings = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.leggings = null;
        }
        if (saveData_.shoeObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.shoeObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.shoes = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.shoes = null;
        }
        if (saveData_.gloveObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.gloveObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.gloves = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.gloves = null;
        }
        if (saveData_.cloakObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.cloakObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.cloak = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.cloak = null;
        }
        if (saveData_.necklaceObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.necklaceObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.necklace = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.necklace = null;
        }
        if (saveData_.ringObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.ringObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.ring = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charInventory.ring = null;
        }
        if (saveData_.leftHandObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.leftHandObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.leftHand = itemObj.GetComponent <Weapon>();
        }
        else
        {
            this.charInventory.leftHand = null;
        }
        if (saveData_.rightHandObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.rightHandObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charInventory.rightHand = itemObj.GetComponent <Weapon>();
        }
        else
        {
            this.charInventory.rightHand = null;
        }

        //Looping through all of the inventory slot objects in the save data
        this.charInventory.itemSlots = new List <Item>();
        for (int i = 0; i < saveData_.inventorySlots.Count; ++i)
        {
            //If the current item is emtpy, we add an empty slot
            if (saveData_.inventorySlots[i] == "")
            {
                this.charInventory.itemSlots.Add(null);
            }
            //If the current item isn't empty, we add it's item component to our inventory
            else
            {
                PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.inventorySlots[i], typeof(PrefabIDTagData)) as PrefabIDTagData;
                GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.objType, prefabID.iDNumber));

                itemObj.transform.SetParent(this.transform);
                this.charInventory.itemSlots.Add(itemObj.GetComponent <Item>());
            }
        }
        for (int s = 0; s < saveData_.stackedItems.Count; ++s)
        {
            //Making sure the item in this item stack matches the same item in the
            //Getting the stack data
            InventoryItemStackData stackData  = JsonUtility.FromJson(saveData_.stackedItems[s], typeof(InventoryItemStackData)) as InventoryItemStackData;
            GameObject             stackedObj = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(stackData.objType, stackData.iDNumber));

            //Making sure the stacked object is actually an item
            if (stackedObj.GetComponent <Item>())
            {
                //Making sure the item in this stack matches the item in the designated inventory index
                if (stackData.itemStackIndex < this.charInventory.itemSlots.Count &&
                    this.charInventory.itemSlots[stackData.itemStackIndex].GetComponent <IDTag>().numberID == stackData.iDNumber)
                {
                    //Looping through every item that's in this stack
                    for (int si = 0; si < stackData.numberOfItemsInStack; ++si)
                    {
                        //Creating a new instance of the stacked item
                        GameObject stackedItem = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(stackData.objType, stackData.iDNumber));
                        //Parenting the stacked item to the one that's in the inventory slot
                        stackedItem.transform.SetParent(this.charInventory.itemSlots[stackData.itemStackIndex].transform);
                        //Increasing the stack size count in the inventory slot
                        this.charInventory.itemSlots[stackData.itemStackIndex].currentStackSize += 1;

                        //If the inventory slot has reached the max stack size, we stop
                        if (this.charInventory.itemSlots[stackData.itemStackIndex].currentStackSize >= this.charInventory.itemSlots[stackData.itemStackIndex].maxStackSize)
                        {
                            break;
                        }
                    }
                }
            }
        }
        this.charInventory.FindArmorStats();

        //Setting the variables in Skill.cs
        this.charSkills.LoadSkillValue(saveData_);

        //Setting the variables in PhysicalState.cs
        this.charPhysState.maxHealth           = saveData_.maxHP;
        this.charPhysState.currentHealth       = saveData_.currentHP;
        this.charPhysState.requiresFood        = saveData_.requireFood;
        this.charPhysState.maxFood             = saveData_.maxFood;
        this.charPhysState.currentFood         = saveData_.currentFood;
        this.charPhysState.requiresWater       = saveData_.requireWater;
        this.charPhysState.maxWater            = saveData_.maxWater;
        this.charPhysState.currentWater        = saveData_.currentWater;
        this.charPhysState.requiresSleep       = saveData_.requireSleep;
        this.charPhysState.maxSleep            = saveData_.maxSleep;
        this.charPhysState.currentSleep        = saveData_.currentSleep;
        this.charPhysState.startingHealthCurve = saveData_.startingHealthCurve;
        this.charPhysState.healthCurveLevels   = saveData_.healthCurveLevels;

        this.charPhysState.highestHealthPercent = saveData_.highestHealthPercent;
        this.charPhysState.highestFoodPercent   = saveData_.highestFoodPercent;
        this.charPhysState.highestWaterPercent  = saveData_.highestWaterPercent;
        this.charPhysState.highestSleepPercent  = saveData_.highestSleepPercent;

        this.charPhysState.trackingHealthPercents = saveData_.trackingHealthPercents;
        this.charPhysState.trackingFoodPercents   = saveData_.trackingFoodPercents;
        this.charPhysState.trackingWaterPercents  = saveData_.trackingWaterPercents;
        this.charPhysState.trackingSleepPercents  = saveData_.trackingSleepPercents;

        //Setting the variables in CombatStats.cs
        this.charCombatStats.currentInitiativeSpeed = saveData_.currentInitiativeSpeed;
        this.charCombatStats.startingPositionCol    = saveData_.startingCol;
        this.charCombatStats.startingPositionRow    = saveData_.startingRow;
        this.charCombatStats.accuracy = saveData_.accuracy;
        this.charCombatStats.evasion  = saveData_.evasion;

        this.charCombatStats.combatEffects = new List <Effect>();
        for (int ce = 0; ce < saveData_.combatEffects.Count; ++ce)
        {
            this.charCombatStats.combatEffects.Add(JsonUtility.FromJson(saveData_.combatEffects[ce], typeof(Effect)) as Effect);
        }

        //Setting the variables in ActionList.cs
        this.charActionList.defaultActions = new List <Action>();
        for (int da = 0; da < saveData_.defaultActions.Count; ++da)
        {
            PrefabIDTagData actionData = JsonUtility.FromJson(saveData_.defaultActions[da], typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.objType, actionData.iDNumber);
            this.charActionList.defaultActions.Add(actionObj.GetComponent <Action>());
        }
        this.charActionList.rechargingSpells = new List <SpellRecharge>();
        for (int rs = 0; rs < saveData_.rechargingSpells.Count; ++rs)
        {
            this.charActionList.rechargingSpells.Add(JsonUtility.FromJson(saveData_.rechargingSpells[rs], typeof(SpellRecharge)) as SpellRecharge);
        }

        //Setting the variables in CharacterSprites.cs
        this.charSprites.allSprites = saveData_.ourSprites;

        //Setting the variables in PerkList.cs
        this.charPerks.allPerks = new List <Perk>();
        for (int p = 0; p < saveData_.perkNames.Count; ++p)
        {
            PrefabIDTagData perkTagData = JsonUtility.FromJson(saveData_.perkNames[p], typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      loadedPerk  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(perkTagData.objType, perkTagData.iDNumber));
            this.charPerks.allPerks.Add(loadedPerk.GetComponent <Perk>());
        }
    }
Ejemplo n.º 4
0
    //Constructor for this class
    public CharacterSaveData(Character characterToSave_)
    {
        //Setting variables from Character.cs
        this.firstName = characterToSave_.firstName;
        this.lastName  = characterToSave_.lastName;
        this.sex       = characterToSave_.sex;

        //Setting variables from RaceTypes.cs
        this.race        = characterToSave_.charRaceTypes.race;
        this.subtypeList = characterToSave_.charRaceTypes.subtypeList;

        //Setting variables from Skills.cs
        this.unarmed       = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Unarmed);
        this.daggers       = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Daggers);
        this.swords        = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Swords);
        this.mauls         = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Mauls);
        this.poles         = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Poles);
        this.bows          = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Bows);
        this.shields       = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Shields);
        this.arcaneMagic   = characterToSave_.charSkills.GetSkillLevelValue(SkillList.ArcaneMagic);
        this.holyMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.HolyMagic);
        this.darkMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.DarkMagic);
        this.fireMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.FireMagic);
        this.waterMagic    = characterToSave_.charSkills.GetSkillLevelValue(SkillList.WaterMagic);
        this.windMagic     = characterToSave_.charSkills.GetSkillLevelValue(SkillList.WindMagic);
        this.electricMagic = characterToSave_.charSkills.GetSkillLevelValue(SkillList.ElectricMagic);
        this.stoneMagic    = characterToSave_.charSkills.GetSkillLevelValue(SkillList.StoneMagic);
        this.survivalist   = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Survivalist);
        this.social        = characterToSave_.charSkills.GetSkillLevelValue(SkillList.Social);

        //Setting variables from PhysicalState.cs
        this.maxHP               = characterToSave_.charPhysState.maxHealth;
        this.currentHP           = characterToSave_.charPhysState.currentHealth;
        this.maxFood             = characterToSave_.charPhysState.maxFood;
        this.currentFood         = characterToSave_.charPhysState.currentFood;
        this.maxWater            = characterToSave_.charPhysState.maxWater;
        this.currentWater        = characterToSave_.charPhysState.currentWater;
        this.maxSleep            = characterToSave_.charPhysState.maxSleep;
        this.currentSleep        = characterToSave_.charPhysState.currentSleep;
        this.requireFood         = characterToSave_.charPhysState.requiresFood;
        this.requireWater        = characterToSave_.charPhysState.requiresWater;
        this.requireSleep        = characterToSave_.charPhysState.requiresSleep;
        this.startingHealthCurve = characterToSave_.charPhysState.startingHealthCurve;
        this.healthCurveLevels   = characterToSave_.charPhysState.healthCurveLevels;

        this.highestHealthPercent = characterToSave_.charPhysState.highestHealthPercent;
        this.highestFoodPercent   = characterToSave_.charPhysState.highestFoodPercent;
        this.highestWaterPercent  = characterToSave_.charPhysState.highestWaterPercent;
        this.highestSleepPercent  = characterToSave_.charPhysState.highestSleepPercent;

        this.trackingHealthPercents = characterToSave_.charPhysState.trackingHealthPercents;
        this.trackingFoodPercents   = characterToSave_.charPhysState.trackingFoodPercents;
        this.trackingWaterPercents  = characterToSave_.charPhysState.trackingWaterPercents;
        this.trackingSleepPercents  = characterToSave_.charPhysState.trackingSleepPercents;

        //Setting variables from CombatStats.cs
        this.currentInitiativeSpeed = characterToSave_.charCombatStats.currentInitiativeSpeed;
        this.startingCol            = characterToSave_.charCombatStats.startingPositionCol;
        this.startingRow            = characterToSave_.charCombatStats.startingPositionRow;
        this.accuracy = characterToSave_.charCombatStats.accuracy;
        this.evasion  = characterToSave_.charCombatStats.evasion;

        this.combatEffects = new List <string>();
        for (int ce = 0; ce < characterToSave_.charCombatStats.combatEffects.Count; ++ce)
        {
            this.combatEffects.Add(JsonUtility.ToJson(characterToSave_.charCombatStats.combatEffects[ce]));
        }

        //Setting variables from ActionList.cs
        this.defaultActions = new List <string>();
        for (int da = 0; da < characterToSave_.charActionList.defaultActions.Count; ++da)
        {
            PrefabIDTagData actionIDData = new PrefabIDTagData(characterToSave_.charActionList.defaultActions[da].GetComponent <IDTag>());
            this.defaultActions.Add(JsonUtility.ToJson(actionIDData));
        }

        this.rechargingSpells = new List <string>();
        for (int rs = 0; rs < characterToSave_.charActionList.rechargingSpells.Count; ++rs)
        {
            this.rechargingSpells.Add(JsonUtility.ToJson(characterToSave_.charActionList.rechargingSpells[rs]));
        }

        //Setting variables from CharacterSprites.cs
        this.ourSprites = characterToSave_.charSprites.allSprites;

        //Setting all of the equipped object references
        if (characterToSave_.charInventory.helm != null)
        {
            this.helmObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.helm.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.chestPiece != null)
        {
            this.chestObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.chestPiece.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.leggings != null)
        {
            this.legObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.leggings.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.gloves != null)
        {
            this.gloveObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.gloves.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.shoes != null)
        {
            this.shoeObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.shoes.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.cloak != null)
        {
            this.cloakObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.cloak.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.necklace != null)
        {
            this.necklaceObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.necklace.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.ring != null)
        {
            this.ringObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.ring.GetComponent <IDTag>()));
        }

        if (characterToSave_.charInventory.leftHand != null)
        {
            this.leftHandObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.leftHand.GetComponent <IDTag>()));
        }
        if (characterToSave_.charInventory.rightHand != null)
        {
            this.rightHandObj = JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charInventory.rightHand.GetComponent <IDTag>()));
        }

        //Looping through all of the character inventory items to save their object references
        this.inventorySlots = new List <string>();
        this.stackedItems   = new List <string>();
        for (int i = 0; i < characterToSave_.charInventory.itemSlots.Count; ++i)
        {
            //Making sure the current inventory object isn't null
            if (characterToSave_.charInventory.itemSlots[i] != null)
            {
                //Reference to the item's IDTag component
                IDTag itemTag = characterToSave_.charInventory.itemSlots[i].GetComponent <IDTag>();

                //Saving the IDTag info
                this.inventorySlots.Add(JsonUtility.ToJson(new PrefabIDTagData(itemTag)));

                //If the current item is a stack
                if (characterToSave_.charInventory.itemSlots[i].currentStackSize > 1)
                {
                    //Creating a new InventoryItemStackData class to store the item stack
                    InventoryItemStackData stack = new InventoryItemStackData(i, itemTag, characterToSave_.charInventory.itemSlots[i].currentStackSize);
                    //Adding a serialized version of the stack data to our list of stacked items
                    this.stackedItems.Add(JsonUtility.ToJson(stack));
                }
            }
            //If the current item is null, we set a null slot to keep the empty space
            else
            {
                this.inventorySlots.Add("");
            }
        }

        //Looping through all of the character perks to save their object references
        this.perkNames = new List <string>();
        for (int p = 0; p < characterToSave_.charPerks.allPerks.Count; ++p)
        {
            //Making sure the current perk isn't null
            if (characterToSave_.charPerks.allPerks[p] != null)
            {
                //Saving this perk's ID tag info
                this.perkNames.Add(JsonUtility.ToJson(new PrefabIDTagData(characterToSave_.charPerks.allPerks[p].GetComponent <IDTag>())));
            }
        }
    }
Ejemplo n.º 5
0
    //Constructor for this class
    public QuestSaveData(Quest ourQuest_)
    {
        //Saving the basic quest info
        this.questName         = ourQuest_.questName;
        this.questDescription  = ourQuest_.questDescription;
        this.isQuestFailed     = ourQuest_.isQuestFailed;
        this.canBeAbandoned    = ourQuest_.canBeAbandoned;
        this.questHours        = ourQuest_.questTimeHours;
        this.currentHours      = ourQuest_.currentHours;
        this.failOnTimeReached = ourQuest_.failOnTimeReached;

        //Serializing the turn in location if it exists
        if (ourQuest_.turnInQuestLoaction != null)
        {
            PrefabIDTagData turnInLocData = new PrefabIDTagData(ourQuest_.turnInQuestLoaction.GetComponent <IDTag>());
            this.turnInLocationObj = JsonUtility.ToJson(turnInLocData, true);
        }
        else
        {
            this.turnInLocationObj = "";
        }

        //Looping through all of our travel destinations
        this.travelDestinations    = new List <string>();
        this.destinationTraveledTo = new List <bool>();
        foreach (QuestTravelDestination td in ourQuest_.destinationList)
        {
            PrefabIDTagData destinationLocData = new PrefabIDTagData(td.requiredLocation.GetComponent <IDTag>());
            this.travelDestinations.Add(JsonUtility.ToJson(destinationLocData, true));
            this.destinationTraveledTo.Add(td.locationVisited);
        }

        //Looping through all of our kill requirements
        this.killTargets        = new List <string>();
        this.requiredKillAmount = new List <int>();
        this.currentKillAmount  = new List <int>();
        foreach (QuestKillRequirement kr in ourQuest_.killList)
        {
            GameObject targetPrefab = UnityEditor.PrefabUtility.FindPrefabRoot(kr.killableEnemy.gameObject);
            this.killTargets.Add(JsonUtility.ToJson(new GameObjectSerializationWrapper(targetPrefab), true));
            this.requiredKillAmount.Add(kr.killsRequired);
            this.currentKillAmount.Add(kr.currentKills);
        }

        //Looping through all of our fetch lists
        this.fetchItems         = new List <string>();
        this.requiredItemAmount = new List <int>();
        this.currentItemAmount  = new List <int>();
        foreach (QuestFetchItems fi in ourQuest_.fetchList)
        {
            PrefabIDTagData itemTagData = new PrefabIDTagData(fi.collectableItem.GetComponent <IDTag>());
            this.fetchItems.Add(JsonUtility.ToJson(itemTagData, true));
            this.requiredItemAmount.Add(fi.itemsRequired);
            this.currentItemAmount.Add(fi.currentItems);
        }

        //Looping through all of our escort lists
        this.escortCharacters = new List <string>();
        this.areEscortsDead   = new List <bool>();
        foreach (QuestEscortCharacter ec in ourQuest_.escortList)
        {
            GameObject characterPrefab = UnityEditor.PrefabUtility.FindPrefabRoot(ec.characterToEscort.gameObject);
            this.escortCharacters.Add(JsonUtility.ToJson(new GameObjectSerializationWrapper(characterPrefab), true));
            this.areEscortsDead.Add(ec.isCharacterDead);
        }

        //Looping through all of our reward items
        this.itemRewards       = new List <string>();
        this.itemRewardAmounts = new List <int>();
        foreach (QuestItemReward ir in ourQuest_.itemRewards)
        {
            PrefabIDTagData itemTagData = new PrefabIDTagData(ir.rewardItem.GetComponent <IDTag>());
            this.itemRewards.Add(JsonUtility.ToJson(itemTagData, true));
            this.itemRewardAmounts.Add(ir.amount);
        }

        //Looping through all of our reward actions
        this.actionRewards           = new List <string>();
        this.actionDistributionTypes = new List <QuestActionReward.DistributionType>();
        foreach (QuestActionReward ar in ourQuest_.actionRewards)
        {
            this.actionRewards.Add(JsonUtility.ToJson(new PrefabIDTagData(ar.rewardAction.GetComponent <IDTag>()), true));
            this.actionDistributionTypes.Add(ar.rewardDistribution);
        }
    }
Ejemplo n.º 6
0
    //Function called from SaveLoadManager.cs to load in saved quest data
    public void LoadQuestLogData(List <string> qSave_)
    {
        //Looping through each quest save data class that was loaded
        foreach (string loadQuest in qSave_)
        {
            //De-serializing the loaded quest string to a QuestSaveData class
            QuestSaveData questData = JsonUtility.FromJson(loadQuest, typeof(QuestSaveData)) as QuestSaveData;
            //Creating a new quest to hold the laoded data
            Quest q = new Quest();

            //Setting all of the basic quest info
            q.questName         = questData.questName;
            q.questDescription  = questData.questDescription;
            q.isQuestFailed     = questData.isQuestFailed;
            q.canBeAbandoned    = questData.canBeAbandoned;
            q.questTimeHours    = questData.questHours;
            q.currentHours      = questData.currentHours;
            q.failOnTimeReached = questData.failOnTimeReached;
            if (questData.turnInLocationObj == "")
            {
                q.turnInQuestLoaction = null;
            }
            else
            {
                PrefabIDTagData turnInLocData = JsonUtility.FromJson(questData.turnInLocationObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
                GameObject      turnInLocObj  = IDManager.globalReference.GetPrefabFromID(turnInLocData.objType, turnInLocData.iDNumber);
                q.turnInQuestLoaction = turnInLocObj.GetComponent <MapLocation>();
            }

            //Looping through all of our travel destinations
            q.destinationList = new List <QuestTravelDestination>();
            for (int td = 0; td < questData.travelDestinations.Count; ++td)
            {
                //Getting a new quest destination class to add to our quest's list
                QuestTravelDestination questDestination = new QuestTravelDestination();

                //Getting the map location for this destination
                string          loadLoc    = questData.travelDestinations[td];
                PrefabIDTagData mapLocData = JsonUtility.FromJson(loadLoc, typeof(PrefabIDTagData)) as PrefabIDTagData;
                GameObject      mapLocObj  = IDManager.globalReference.GetPrefabFromID(mapLocData.objType, mapLocData.iDNumber);

                questDestination.requiredLocation = mapLocObj.GetComponent <MapLocation>();
                questDestination.locationVisited  = questData.destinationTraveledTo[td];

                //Adding the quest destination to our quest
                q.destinationList.Add(questDestination);
            }

            //Looping through all of our kill lists
            q.killList = new List <QuestKillRequirement>();
            for (int kr = 0; kr < questData.killTargets.Count; ++kr)
            {
                //Getting a new quest kill class to add to our quest's list
                QuestKillRequirement questKill = new QuestKillRequirement();

                //Getting the character to kill for this requirement
                string loadKill = questData.killTargets[kr];
                GameObjectSerializationWrapper targetObj = JsonUtility.FromJson(loadKill, typeof(GameObjectSerializationWrapper)) as GameObjectSerializationWrapper;

                questKill.killableEnemy = targetObj.objToSave.GetComponent <Character>();
                questKill.killsRequired = questData.requiredKillAmount[kr];
                questKill.currentKills  = questData.currentKillAmount[kr];

                //Adding the kill requirement to our quest
                q.killList.Add(questKill);
            }

            //Looping through all of our fetch items
            q.fetchList = new List <QuestFetchItems>();
            for (int fi = 0; fi < questData.fetchItems.Count; ++fi)
            {
                //Getting a new fetch item class to add to our quest's list
                QuestFetchItems questFetch = new QuestFetchItems();

                //Getting the item to collect for this requirement
                string          loadItem = questData.fetchItems[fi];
                PrefabIDTagData itemData = JsonUtility.FromJson(loadItem, typeof(PrefabIDTagData)) as PrefabIDTagData;
                GameObject      itemObj  = IDManager.globalReference.GetPrefabFromID(itemData.objType, itemData.iDNumber);

                questFetch.collectableItem = itemObj.GetComponent <Item>();
                questFetch.itemsRequired   = questData.requiredItemAmount[fi];
                questFetch.currentItems    = questData.currentItemAmount[fi];

                //Adding the item requirement to our quest
                q.fetchList.Add(questFetch);
            }

            //Looping through all of our escort characters
            q.escortList = new List <QuestEscortCharacter>();
            for (int ec = 0; ec < questData.escortCharacters.Count; ++ec)
            {
                //Getting a new escort class to add to our quest's list
                QuestEscortCharacter questEscort = new QuestEscortCharacter();

                //Getting the character to escort for this requirement
                string loadChar = questData.escortCharacters[ec];
                GameObjectSerializationWrapper charObj = JsonUtility.FromJson(loadChar, typeof(GameObjectSerializationWrapper)) as GameObjectSerializationWrapper;

                questEscort.characterToEscort = charObj.objToSave.GetComponent <Character>();
                questEscort.isCharacterDead   = questData.areEscortsDead[ec];

                //Adding the escort requirement to our quest
                q.escortList.Add(questEscort);
            }

            //Looping through all of our item rewards
            q.itemRewards = new List <QuestItemReward>();
            for (int ir = 0; ir < questData.itemRewards.Count; ++ir)
            {
                //Getting a new item reward class to add to our quest's list
                QuestItemReward itemReward = new QuestItemReward();

                //Getting the item that is awarded
                string          loadItem = questData.itemRewards[ir];
                PrefabIDTagData itemData = JsonUtility.FromJson(loadItem, typeof(PrefabIDTagData)) as PrefabIDTagData;
                GameObject      itemObj  = IDManager.globalReference.GetPrefabFromID(itemData.objType, itemData.iDNumber);

                itemReward.rewardItem = itemObj.GetComponent <Item>();
                itemReward.amount     = questData.itemRewardAmounts[ir];

                //Adding the item reward to our quest
                q.itemRewards.Add(itemReward);
            }

            //Looping through all of our action rewards
            q.actionRewards = new List <QuestActionReward>();
            for (int ar = 0; ar < questData.actionRewards.Count; ++ar)
            {
                //Getting a new action reward class to add to our quest's list
                QuestActionReward actionReward = new QuestActionReward();

                //Getting the action object that is awarded
                string          loadAction = questData.actionRewards[ar];
                PrefabIDTagData actionData = JsonUtility.FromJson(loadAction, typeof(PrefabIDTagData)) as PrefabIDTagData;
                GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.objType, actionData.iDNumber);

                actionReward.rewardAction       = actionObj.GetComponent <Action>();
                actionReward.rewardDistribution = questData.actionDistributionTypes[ar];

                //Adding the action reward to our quests
                q.actionRewards.Add(actionReward);
            }


            //Adding the loaded quest to our quest log
            this.questLog.Add(q);
        }
    }
Ejemplo n.º 7
0
    //Function called externally from SaveLoadManager.cs to load this character's component data
    public void LoadCharacterFromSave(CharacterSaveData saveData_)
    {
        //Setting the Character.cs variables
        this.charName  = saveData_.charName;
        this.className = saveData_.className;

        //Setting the RaceTypes.cs variables
        this.charRaceTypes.race        = saveData_.race;
        this.charRaceTypes.subtypeList = saveData_.subtypeList;

        //Setting all of the equipped items in Inventory.cs
        if (saveData_.helmObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.helmObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charEquipment.helm = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charEquipment.helm = null;
        }
        if (saveData_.chestObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.chestObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charEquipment.body = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charEquipment.body = null;
        }
        if (saveData_.trinketObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.trinketObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charEquipment.trinket = itemObj.GetComponent <Armor>();
        }
        else
        {
            this.charEquipment.trinket = null;
        }
        if (saveData_.leftHandObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.leftHandObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charEquipment.leftHand = itemObj.GetComponent <Weapon>();
        }
        else
        {
            this.charEquipment.leftHand = null;
        }
        if (saveData_.rightHandObj != "")
        {
            PrefabIDTagData prefabID = JsonUtility.FromJson(saveData_.rightHandObj, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      itemObj  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(prefabID.iDNumber));

            itemObj.transform.SetParent(this.transform);
            this.charEquipment.rightHand = itemObj.GetComponent <Weapon>();
        }
        else
        {
            this.charEquipment.rightHand = null;
        }

        this.charEquipment.FindArmorStats();

        //Setting the variables in Skill.cs
        this.charSkills.LoadSkillValue(saveData_);

        //Setting the variables in PhysicalState.cs
        this.charPhysState.maxHealth       = saveData_.maxHP;
        this.charPhysState.currentHealth   = saveData_.currentHP;
        this.charPhysState.corruptionLevel = saveData_.corruptionLevel;

        //Setting the variables in CombatStats.cs
        this.charCombatStats.currentInitiativeSpeed = saveData_.currentInitiativeSpeed;
        this.charCombatStats.startingPositionCol    = saveData_.startingCol;
        this.charCombatStats.startingPositionRow    = saveData_.startingRow;
        this.charCombatStats.accuracy = saveData_.accuracy;
        this.charCombatStats.evasion  = saveData_.evasion;

        this.charCombatStats.combatEffects = new List <Effect>();
        for (int ce = 0; ce < saveData_.combatEffects.Count; ++ce)
        {
            this.charCombatStats.combatEffects.Add(JsonUtility.FromJson(saveData_.combatEffects[ce], typeof(Effect)) as Effect);
        }

        //Setting the variables in ActionList.cs
        if (saveData_.action1 != "")
        {
            PrefabIDTagData actionData = JsonUtility.FromJson(saveData_.action1, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.iDNumber);
            this.charActionList.actionSlot1 = actionObj.GetComponent <Action>();
        }
        if (saveData_.action2 != "")
        {
            PrefabIDTagData actionData = JsonUtility.FromJson(saveData_.action2, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.iDNumber);
            this.charActionList.actionSlot2 = actionObj.GetComponent <Action>();
        }
        if (saveData_.action3 != "")
        {
            PrefabIDTagData actionData = JsonUtility.FromJson(saveData_.action3, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.iDNumber);
            this.charActionList.actionSlot3 = actionObj.GetComponent <Action>();
        }
        if (saveData_.action4 != "")
        {
            PrefabIDTagData actionData = JsonUtility.FromJson(saveData_.action4, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.iDNumber);
            this.charActionList.actionSlot4 = actionObj.GetComponent <Action>();
        }
        if (saveData_.action5 != "")
        {
            PrefabIDTagData actionData = JsonUtility.FromJson(saveData_.action5, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.iDNumber);
            this.charActionList.actionSlot5 = actionObj.GetComponent <Action>();
        }
        if (saveData_.ultimateAction != "")
        {
            PrefabIDTagData actionData = JsonUtility.FromJson(saveData_.ultimateAction, typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      actionObj  = IDManager.globalReference.GetPrefabFromID(actionData.iDNumber);
            this.charActionList.ultimateAction = actionObj.GetComponent <Action>();
        }

        this.charActionList.rechargingSpells = new List <SpellRecharge>();
        for (int rs = 0; rs < saveData_.rechargingSpells.Count; ++rs)
        {
            this.charActionList.rechargingSpells.Add(JsonUtility.FromJson(saveData_.rechargingSpells[rs], typeof(SpellRecharge)) as SpellRecharge);
        }

        //Setting the variables in PerkList.cs
        this.charPerks.allPerks = new List <Perk>();
        for (int p = 0; p < saveData_.perkNames.Count; ++p)
        {
            PrefabIDTagData perkTagData = JsonUtility.FromJson(saveData_.perkNames[p], typeof(PrefabIDTagData)) as PrefabIDTagData;
            GameObject      loadedPerk  = GameObject.Instantiate(IDManager.globalReference.GetPrefabFromID(perkTagData.iDNumber));
            this.charPerks.allPerks.Add(loadedPerk.GetComponent <Perk>());
        }

        //Setting the variables in LevelTracker.cs
        this.levelTracker.level              = saveData_.level;
        this.levelTracker.currentEXP         = saveData_.exp;
        this.levelTracker.defaultHealthCurve = saveData_.healthCurve;
        this.levelTracker.healthCurveMod     = saveData_.healthCurveMod;
        this.levelTracker.combatsWonLevel    = saveData_.combatsWonLevel;
        this.levelTracker.spacesMovedLevel   = saveData_.spacesMovedLevel;
        this.levelTracker.damageDealtLevel   = saveData_.damageDealtLevel;
        this.levelTracker.damageTakenLevel   = saveData_.damageTakenLevel;
        this.levelTracker.armorValuesLevel   = saveData_.armorValuesLevel;
        this.levelTracker.healthAvgLevel     = saveData_.healthAvgLevel;

        this.levelTracker.combatsWonLifetime  = saveData_.combatsWonLifetime;
        this.levelTracker.spacesMovedLifetime = saveData_.spacesMovedLifetime;
        this.levelTracker.damageDealtLifetime = saveData_.damageDealtLifetime;
        this.levelTracker.damageTakenLifetime = saveData_.damageTakenLifetime;
        this.levelTracker.armorValuesLifetime = saveData_.armorValuesLifetime;
        this.levelTracker.healthAvgLifetime   = saveData_.healthAvgLifetime;
    }