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;
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
    //Constructor function for this class
    public PartySaveData(PartyGroup groupToSave_)
    {
        this.combatDist = groupToSave_.combatDistance;

        TileColRow tileLocation = TileMapManager.globalReference.GetTileCoords(groupToSave_.GetComponent <WASDOverworldMovement>().currentTile);

        this.tileCol = tileLocation.col;
        this.tileRow = tileLocation.row;

        //Looping through all of the characters in the given party and getting their save data
        this.partyCharacters = new List <global::CharacterSaveData>();
        for (int c = 0; c < groupToSave_.charactersInParty.Count; ++c)
        {
            //If the current character isn't null, we save it's data
            if (groupToSave_.charactersInParty[c] != null)
            {
                CharacterSaveData charData = new CharacterSaveData(groupToSave_.charactersInParty[c]);
                this.partyCharacters.Add(charData);
            }
            //If the current character slot is null, we add the empty slot
            else
            {
                this.partyCharacters.Add(null);
            }
        }

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

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

                //If the current item is a stack
                if (groupToSave_.inventory.itemSlots[i].currentStackSize > 1)
                {
                    //Creating a new InventoryItemStackData class to store the item stack
                    InventoryItemStackData stack = new InventoryItemStackData(i, itemTag, groupToSave_.inventory.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("");
            }
        }
    }
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>())));
            }
        }
    }