示例#1
0
        /// <summary>
        /// Clear down the player/HUD before loading a save game.
        /// </summary>
        public void ClearInventoryAndHUD()
        {
#if !VANILLA  // clear inventory
            if (Inventory)
            {
                Inventory.items.Clear();

                // then clear equip display slots
                for (int i = 0; i < Inventory.changeEquipmentControllers.Count; i++)
                {
                    if (Inventory.changeEquipmentControllers[i].display.item)
                    {
                        Inventory.UnequipItem(Inventory.changeEquipmentControllers[i].equipArea, Inventory.changeEquipmentControllers[i].display.item);
                    }
                }

                // also clear equiped melee weapons & consumables
                for (int i = 0; i < Inventory.equipAreas.Length; i++)
                {
                    var validSlot = Inventory.equipAreas[i].ValidSlots;
                    for (int a = 0; a < validSlot.Count; a++)
                    {
                        try
                        {
                            validSlot[a].RemoveItem();
                        }
                        catch { }    // ensure nulls dont crash it
                    }
                }
            }
#endif
            // clear spell triggers
            if (Settings)
            {
                for (int s = 0; s < Settings.SpellsTriggers.Count; s++)
                {  // check all triggers
                    MagicSpellTrigger st = Settings.SpellsTriggers[s];
#if !VANILLA
                    if (st.Input.useInput)
                    {     // enabled
                        for (int i = 0; i < st.EquipSlots.Length; i++)
                        { // check all equip slots
                            try
                            {
                                st.EquipSlots[i].RemoveItem();
                            }
                            catch { }    // ensure nulls dont crash it
                        }
                    }
#endif
                }
            }
        }
示例#2
0
        /// <summary>
        /// Create button event, adds all components.
        /// </summary>
        void Create()
        {
            if (Selection.activeGameObject != null)
            {  // fail safe
                // add melee manager for when shooter
                if (!Selection.activeGameObject.GetComponent <vMeleeManager>())
                {
                    Selection.activeGameObject.AddComponent <vMeleeManager>();
                }

                // inventory
                vItemManager itemManager = Selection.activeGameObject.GetComponent <vItemManager>();
                if (!itemManager)
                {
                    itemManager = Selection.activeGameObject.AddComponent <vItemManager>();
                    vItemManagerUtilities.CreateDefaultEquipPoints(itemManager, itemManager.GetComponent <vMeleeManager>());
                }
                itemManager.inventoryPrefab = InventoryPrefab;
                itemManager.itemListData    = ItemListData;
                itemManager.itemsFilter.Add(vItemType.MeleeWeapon);
                itemManager.itemsFilter.Add(vItemType.Spell);

                // hit damage particle
                vHitDamageParticle hitDamageParticle = Selection.activeGameObject.GetComponent <vHitDamageParticle>();
                if (!hitDamageParticle)
                {
                    hitDamageParticle = Selection.activeGameObject.AddComponent <vHitDamageParticle>();
                }
                hitDamageParticle.defaultDamageEffect = HitDamageParticle;

                // UI
                GameObject goItemCollectionDisplay = PrefabUtility.InstantiatePrefab(ItemCollectionDisplay) as GameObject;
                goItemCollectionDisplay.transform.SetParent(UIBase.transform);
                GameObject goInventoryPrefab = PrefabUtility.InstantiatePrefab(InventoryPrefab.gameObject) as GameObject;
                goInventoryPrefab.name = "Inventory_MeleeMagic_Auto";


                // leveling system
                CharacterInstance levelingsystem = Selection.activeGameObject.GetComponent <CharacterInstance>();
                if (!levelingsystem)
                {
                    levelingsystem = Selection.activeGameObject.AddComponent <CharacterInstance>();
                }

                // link the invector character damage event to the leveling system
                vThirdPersonController thirdp = Selection.activeGameObject.GetComponent <vThirdPersonController>();
                UnityEventTools.AddPersistentListener(thirdp.onReceiveDamage, levelingsystem.OnRecieveDamage);

                // link the melee manager hits to the leveling system
                vMeleeManager meleeM = Selection.activeGameObject.GetComponent <vMeleeManager>();
                if (meleeM)
                {
                    if (meleeM.onDamageHit == null)
                    {
                        meleeM.onDamageHit = new vOnHitEvent();
                    }
                    UnityEventTools.AddPersistentListener(meleeM.onDamageHit, levelingsystem.OnSendHit);
                }

                // add conditions and update particles to use the LOD 1 mesh
                levelingsystem.Conditions = new List <BaseCondition>();
                levelingsystem.Conditions.Add(new BaseCondition()
                {
                    Type = BaseDamage.Physical
                });
                GameObject goConditionsRoot = new GameObject("Conditions");
                goConditionsRoot.transform.SetParent(Selection.activeGameObject.transform);
                goConditionsRoot.transform.position = new Vector3(0f, 0f, 0f);
                foreach (BaseCondition bc in Conditions)
                {
                    GameObject goCondition = null;
                    if (bc.Display)
                    {
                        // load the prefab
                        goCondition = PrefabUtility.InstantiatePrefab(bc.Display) as GameObject;
                        goCondition.transform.SetParent(goConditionsRoot.transform);
                        goCondition.transform.position = new Vector3(0f, 0f, 0f);

                        // update all particles to use the mesh renderer from LOD1
                        goCondition.SetActive(true);
                        ParticleSystem[] ConditionParticles = goCondition.GetComponentsInChildren <ParticleSystem>();
                        foreach (ParticleSystem p in ConditionParticles)
                        {
                            if (p.shape.enabled)
                            {
                                if (p.shape.shapeType == ParticleSystemShapeType.SkinnedMeshRenderer)
                                {
                                    ParticleSystem.ShapeModule editableShape = p.shape;
                                    editableShape.skinnedMeshRenderer = LOD1BodyMesh[iWhichMesh];
                                }
                            }
                        }
                        goCondition.SetActive(false);
                    }

                    // add to the levelling system
                    levelingsystem.Conditions.Add(new BaseCondition()
                    {
                        Type = bc.Type, Length = 0, Display = goCondition
                    });
                }

                // add the magic spawn point
                GameObject goMagicSpawn = new GameObject("Magic Spawn");
                goMagicSpawn.transform.SetParent(Selection.activeGameObject.transform);
                goMagicSpawn.transform.position = new Vector3(0f, 1.5f, 0.9f);

                // magic input
                MagicSettings magicIO = Selection.activeGameObject.GetComponent <MagicSettings>();
                if (!magicIO)
                {
                    magicIO = Selection.activeGameObject.AddComponent <MagicSettings>();
                }
                magicIO.PooledMagic     = true;
                magicIO.MagicSpawnPoint = goMagicSpawn.transform;
                magicIO.onUseMana       = new UnityIntEvent();
                UnityEventTools.AddPersistentListener(magicIO.onUseMana, levelingsystem.UseMana);


#if !VANILLA                                                                                                         // set spell triggers F1-F5
                GameObject goInventoryWindow    = goInventoryPrefab.transform.Find("InventoryWindow").gameObject;    // grab inventory window
                GameObject goEquipmentInventory = goInventoryWindow.transform.Find("EquipmentInventory").gameObject; // and the equip slot parent
                goEquipmentInventory.SetActive(true);                                                                // enable for component search
                int          iNext    = 1;
                vEquipSlot[] allSlots = goInventoryPrefab.GetComponentsInChildren <vEquipSlot>();
                foreach (vEquipSlot slot in allSlots)
                {
                    if (slot.transform.parent.parent.name == "EquipMentArea_Spells")
                    {                                                                                                      // is a spell inventory area
                        MagicSpellTrigger trigger = new MagicSpellTrigger();                                               // create the trigger
                        trigger.EquipSlots     = new vEquipSlot[] { slot };                                                // set the inventory slot
                        trigger.Input          = new GenericInput("F" + iNext.ToString(), null, null);                     // set the input key
                        trigger.Input.useInput = true;                                                                     // enable
                        vEquipmentDisplay[] allDisplays = goInventoryPrefab.GetComponentsInChildren <vEquipmentDisplay>(); // find all displays
                        foreach (vEquipmentDisplay disp in allDisplays)
                        {                                                                                                  // check all
                            if (disp.gameObject.name == slot.gameObject.name.Replace("EquipSlot ", "EquipDisplay_Spell "))
                            {                                                                                              // found matching name?
                                trigger.EquipDisplay = disp;                                                               // success, apply
                                UnityEventTools.AddPersistentListener(slot.onAddItem, magicIO.SpellEquiped);               // listen for spells equiped
                                UnityEventTools.AddPersistentListener(slot.onRemoveItem, magicIO.SpellUnEquiped);          // and unequiped
                                break;                                                                                     // drop out
                            }
                        }
                        magicIO.SpellsTriggers.Add(trigger); // add the trigger
                        iNext += 1;                          // next please
                    }
                }
                goEquipmentInventory.SetActive(false);  // deactivate the inventory display
#endif

                // link the UI further
                Transform tHUD = UIBase.transform.Find("HUD");
                magicIO.XPText      = tHUD.Find("XP").GetComponent <UnityEngine.UI.Text>();
                magicIO.LevelText   = tHUD.Find("Level").GetComponent <UnityEngine.UI.Text>();
                magicIO.LevelUpText = tHUD.Find("Level up").GetComponent <UnityEngine.UI.Text>();
                magicIO.ManaSlider  = tHUD.Find("mana").GetComponent <UnityEngine.UI.Slider>();

#if !VANILLA
                itemManager.onUseItem = new OnHandleItemEvent();
                UnityEventTools.AddPersistentListener(itemManager.onUseItem, magicIO.UsePotion);

                // also lock input when inventory open
                itemManager.onOpenCloseInventory = new OnOpenCloseInventory();
                vMeleeCombatInput MeleeInput = Selection.activeGameObject.GetComponent <vMeleeCombatInput>();
                if (MeleeInput)
                {
                    UnityEventTools.AddPersistentListener(itemManager.onOpenCloseInventory, MeleeInput.SetLockMeleeInput);
                }
#endif
                // work complete
                this.Close();
            }
            else
            {
                Debug.Log("Please select the Player to add these components.");
            }
        }
示例#3
0
        /// <summary>
        /// Add a check UI links validator to the default inspector window.
        /// </summary>
        public override void OnInspectorGUI()
        {
            defaultSkin = GUI.skin;
            if (skin)
            {
                GUI.skin = skin;
            }
            GUILayout.BeginVertical("MAGIC SETTINGS", "window");
            GUILayout.Space(30);

            // validate the interface to player links
            if (GUILayout.Button("Check UI->Player Links", GUILayout.ExpandWidth(true)))
            {
                // setup
                GameObject    player         = Selection.activeGameObject;
                MagicSettings settings       = player.GetComponent <MagicSettings>();
                CharacterBase levelingSystem = player.GetComponent <CharacterBase>();
                lastUICheckResults = "";
                int changeCount = 0;

                // check magic spawn point
                if (!settings.MagicSpawnPoint)
                {
                    Transform tMagicSpawn = player.transform.Find("Magic Spawn");
                    if (!tMagicSpawn)
                    {
                        GameObject goMagicSpawn = new GameObject("Magic Spawn");
                        goMagicSpawn.transform.SetParent(player.transform);
                        goMagicSpawn.transform.position = new Vector3(0f, 1.5f, 0.9f);
                        settings.MagicSpawnPoint        = goMagicSpawn.transform;
                    }
                    else
                    {
                        settings.MagicSpawnPoint = tMagicSpawn;
                    }

                    changeCount        += 1;
                    lastUICheckResults += "Added Magic Spawn Point\r\n";
                }

                // leveling system on use mana connection
                if (levelingSystem)
                {
                    settings.onUseMana = new UnityIntEvent();
                    UnityEventTools.AddPersistentListener(settings.onUseMana, levelingSystem.UseMana);
                    changeCount        += 1;
                    lastUICheckResults += "Re-Linked leveling system to onUseMana\r\n";
                }
                else
                {
                    lastUICheckResults += "Optional Leveling system is missing, onUseMana not handled\r\n";
                }

                // check links between inventory ui and the player
                vItemManager itemManager = player.GetComponent <vItemManager>();
                if (!itemManager)
                {
                    lastUICheckResults += "vItemManager is MISSING\r\n";
                }
                else  // found, checking slot links
                {
                    GameObject goInventoryWindow    = itemManager.inventoryPrefab.transform.Find("InventoryWindow").gameObject; // grab inventory window
                    GameObject goEquipmentInventory = goInventoryWindow.transform.Find("EquipmentInventory").gameObject; // and the equip slot parent
                    goEquipmentInventory.SetActive(true);                                                                // enable for component search
                    int          iNext    = 1;
                    vEquipSlot[] allSlots = itemManager.inventoryPrefab.transform.GetComponentsInChildren <vEquipSlot>();
                    settings.SpellsTriggers.Clear();
                    foreach (vEquipSlot slot in allSlots)
                    {
                        if (slot.transform.parent.parent.name == "EquipMentArea_Spells")  // is a spell inventory area
                        {
                            slot.onAddItem    = new OnHandleItemEvent();
                            slot.onRemoveItem = new OnHandleItemEvent();
                            MagicSpellTrigger trigger = new MagicSpellTrigger();                                                                   // create the trigger
                            trigger.EquipSlots     = new vEquipSlot[] { slot };                                                                    // set the inventory slot
                            trigger.Input          = new GenericInput("F" + iNext.ToString(), null, null);                                         // set the input key
                            trigger.Input.useInput = true;                                                                                         // enable
                            vEquipmentDisplay[] allDisplays = itemManager.inventoryPrefab.transform.GetComponentsInChildren <vEquipmentDisplay>(); // find all displays
                            foreach (vEquipmentDisplay disp in allDisplays)                                                                        // check all
                            {
                                if (disp.gameObject.name == slot.gameObject.name.Replace("EquipSlot ", "EquipDisplay_Spell "))                     // found matching name?
                                {
                                    trigger.EquipDisplay = disp;                                                                                   // success, apply
                                    UnityEventTools.AddPersistentListener(slot.onAddItem, settings.SpellEquiped);                                  // listen for spells equiped
                                    UnityEventTools.AddPersistentListener(slot.onRemoveItem, settings.SpellUnEquiped);                             // and unequiped
                                    break;                                                                                                         // drop out
                                }
                            }
                            settings.SpellsTriggers.Add(trigger); // add the trigger
                            iNext += 1;                           // next please
                        }
                    }
                    goEquipmentInventory.SetActive(false);  // deactivate the inventory display

                    changeCount        += 1;
                    lastUICheckResults += "Re-Linked inventory/UI display slots to the player\r\n";

                    // check use potion links
                    itemManager.onUseItem = new OnHandleItemEvent();
                    UnityEventTools.AddPersistentListener(itemManager.onUseItem, settings.UsePotion);

                    changeCount        += 1;
                    lastUICheckResults += "Re-Linked item manager use potion to the player\r\n";
                }

                // finish up
                lastUICheckResults += "All done " + changeCount.ToString() + " changes applied\r\n\r\n";
            }
            GUILayout.Label(lastUICheckResults, GUILayout.ExpandWidth(true));

            // output the base inspector window
            GUI.skin = defaultSkin;
            base.OnInspectorGUI();
            GUI.skin = skin;
            GUILayout.EndVertical();
            GUI.skin = defaultSkin;
        }
示例#4
0
        /// <summary>
        /// Save the player state and level to the abstract data layer.
        /// </summary>
        /// <param name="LevelingSystem">Leveling system to save.</param>
        /// <param name="SceneName">Name of the current scene.</param>
        /// <param name="SaveGameID">ID of the save game or zero for new.</param>
        /// <returns>SaveGame ID updated.</returns>
        public int SavePlayerState(ref CharacterBase LevelingSystem, string SceneName, int SaveGameID)
        {
            try
            {
                // create or update the save header
                SaveHeader(ref LevelingSystem.SaveSlotID, ref SaveGameID, SceneName,
                           BuildHeaderDataBlock(ref LevelingSystem, (LevelingSystem.SaveSlotID == 0)));

                // save all attributes
                for (int i = 0; i < LevelingSystem.Skills.Count; i++)
                {
                    SaveAttribute(SaveGameID, 100 + (int)LevelingSystem.Skills[i].Skill, LevelingSystem.Skills[i].Value);
                }
                for (int i = 0; i < LevelingSystem.Resist.Count; i++)
                {
                    SaveAttribute(SaveGameID, 200 + (int)LevelingSystem.Resist[i].Resist, LevelingSystem.Resist[i].Value);
                }
                for (int i = 0; i < LevelingSystem.Collectables.Count; i++)
                {
                    SaveAttribute(SaveGameID, 300 + (int)LevelingSystem.Collectables[i].Type, LevelingSystem.Collectables[i].Value);
                }


#if !VANILLA    // save inventory
                if (Inventory)
                {
                    foreach (vItem vi in Inventory.items)
                    {
                        SaveAttribute(SaveGameID, 1000 + vi.id, vi.amount);
                    }

                    // also save equipped melee weapons & consumables
                    for (int i = 0; i < Inventory.equipAreas.Length; i++)
                    {
                        var equipArea = Inventory.equipAreas[i];
                        var validSlot = equipArea.ValidSlots;
                        for (int a = 0; a < validSlot.Count; a++)
                        {
                            if (validSlot[a].item != null && validSlot[a].item.type != vItemType.Spell)
                            {
                                SaveAttribute(SaveGameID, 500 + (i * 10) + a, validSlot[a].item.id + 1);  // save equiped vItem id as +1
                            }
                        }
                    }

                    // then save equip display slots
                    for (int i = 0; i < Inventory.changeEquipmentControllers.Count; i++)
                    {
                        if (Inventory.changeEquipmentControllers[i].display.item)
                        {
                            SaveAttribute(SaveGameID, 600 + i, Inventory.changeEquipmentControllers[i].display.item.id + 1);  // save active equiped vItem id as +1
                        }
                    }
                }
#endif
                // spell triggers
                if (Settings)
                {
                    for (int s = 0; s < Settings.SpellsTriggers.Count; s++)
                    {  // check all triggers
                        MagicSpellTrigger st = Settings.SpellsTriggers[s];
#if !VANILLA
                        if (st.Input.useInput)
                        {                                                                                            // enabled
                            for (int i = 0; i < st.EquipSlots.Length; i++)
                            {                                                                                        // check all equp slots for this trigger
                                if (st.EquipSlots[i])
                                {                                                                                    // invector inventory
                                    if (st.EquipSlots[i].item)
                                    {                                                                                // has an item
                                        SaveAttribute(SaveGameID, 400 + (s * 10) + i, st.EquipSlots[i].item.id + 1); // save equiped vItem id as +1
                                    }
                                }
                            }
                        }
#endif
                    }
                }

                // success
                if (GlobalFuncs.DEBUGGING_MESSAGES)
                {
                    Debug.Log("Save Completed..");
                }
                return(SaveGameID);
            }
            catch (Exception ex)
            {
                if (GlobalFuncs.DEBUGGING_MESSAGES)
                {
                    Debug.Log("SavePlayerState(" + LevelingSystem.Name + "," + SceneName + "," + SaveGameID.ToString() + ") " + ex.Message);
                }
                return(-1);
            }
            finally
            {  // ensure clean up happens, even on error
                CleanUp();
            }
        }
示例#5
0
        /// <summary>
        /// Load a save game from the abstract data layer.
        /// </summary>
        /// <param name="LevelingSystem">Leveling system to load into.</param>
        /// <param name="SaveGameID">ID of the save game to load.</param>
        /// <returns>Name of scene to load.</returns>
        public string LoadPlayerState(ref CharacterBase LevelingSystem, int SaveGameID)
        {
            try
            {
                // load the header values
                string SceneName = "EDITOR";
                List <SimpleDataHeader> HeaderData = BuildHeaderDataBlock(ref LevelingSystem, true);
                LoadHeader(SaveGameID, ref SceneName, ref HeaderData);

                // process the data into the leveling system
                foreach (SimpleDataHeader sdh in HeaderData)
                {
                    switch (sdh.Name)
                    {
                    case "CharacterName":
                        LevelingSystem.Name = sdh.Value;
                        break;

                    case "Axis":
                        LevelingSystem.CurrentAxis = (BaseAxis)Convert.ToInt32(sdh.Value);
                        break;

                    case "Alignment":
                        LevelingSystem.CurrentAlignment = (BaseAlignment)Convert.ToInt32(sdh.Value);
                        break;

                    case "Race":
                        LevelingSystem.CurrentRace = (BaseRace)Convert.ToInt32(sdh.Value);
                        break;

                    case "Class":
                        LevelingSystem.CurrentClass = (BaseClass)Convert.ToInt32(sdh.Value);
                        break;

                    case "Level":
                        LevelingSystem.CurrentLevel = Convert.ToInt32(sdh.Value);
                        break;

                    case "XP":
                        LevelingSystem.CurrentXP = Convert.ToInt32(sdh.Value);
                        break;

                    case "UnspentSkillPoints":
                        LevelingSystem.UnspentSkillPoints = Convert.ToInt32(sdh.Value);
                        break;
                    }
                }

                // load all attributes
                for (int i = 0; i < LevelingSystem.Skills.Count; i++)
                {
                    LevelingSystem.Skills[i].Value = LoadAttribute(SaveGameID, 100 + (int)LevelingSystem.Skills[i].Skill);
                }
                for (int i = 0; i < LevelingSystem.Resist.Count; i++)
                {
                    LevelingSystem.Resist[i].Value = LoadAttribute(SaveGameID, 200 + (int)LevelingSystem.Resist[i].Resist);
                }
                for (int i = 0; i < LevelingSystem.Collectables.Count; i++)
                {
                    LevelingSystem.Collectables[i].Value = LoadAttribute(SaveGameID, 300 + (int)LevelingSystem.Collectables[i].Type);
                }

#if !VANILLA
                // then load equip display slots
                for (int i = 0; i < Inventory.changeEquipmentControllers.Count; i++)
                {
                    int EquipedItemID = (int)LoadAttribute(SaveGameID, 600 + i);  // load from data layer
                    if (EquipedItemID > 0)
                    {
                        var reference = new ItemReference(EquipedItemID - 1);
                        reference.amount    = 1;
                        reference.autoEquip = true;
                        reference.indexArea = i;
                        ItemManager.AddItem(reference, true);
                    }
                }

                // load inventory
                if (Inventory && ItemListData)
                {
                    Inventory.items.Clear();
                    foreach (vItem vi in ItemListData.items)
                    {
                        vi.amount = (int)LoadAttribute(SaveGameID, 1000 + vi.id);
                        if (vi.amount > 0)
                        {
                            Inventory.items.Add(vi);
                        }
                    }

                    // also load equipped melee weapons & consumables
                    for (int i = 0; i < Inventory.equipAreas.Length; i++)
                    {
                        var equipArea = Inventory.equipAreas[i];
                        var validSlot = equipArea.ValidSlots;
                        for (int a = 0; a < validSlot.Count; a++)
                        {
                            int EquipedItemID = (int)LoadAttribute(SaveGameID, 500 + (i * 10) + a);   // load from data layer
                            if (EquipedItemID > 0)
                            {                                                                         // found equipped item id
                                vItem vi = ItemListData.items.Find(e => e.id == (EquipedItemID - 1)); // search
                                if (vi)
                                {                                                                     // found the id in the item list data
                                    validSlot[a].AddItem(vi);                                         // add to slot
                                }
                            }
                        }
                    }
                }
#endif

                // spell triggers
                if (Settings)
                {
                    for (int s = 0; s < Settings.SpellsTriggers.Count; s++)
                    {  // check all triggers
                        MagicSpellTrigger st = Settings.SpellsTriggers[s];
#if !VANILLA
                        if (st.Input.useInput)
                        {                                                                                                    // enabled
                            for (int i = 0; i < st.EquipSlots.Length; i++)
                            {                                                                                                // check all equip slots for this trigger
                                int ID = (int)LoadAttribute(SaveGameID, 400 + (s * 10) + i);                                 // attempt load
                                if (ID > 0)
                                {                                                                                            // found in data layer?
                                    vItem viSpell = ItemListData.items.Find(v => v.id == (ID - 1));                          // attempt find vItem in collection, ID is -1 as LoadReterns 0 for not found
                                    if (viSpell)
                                    {                                                                                        // spell item id found?
                                        st.EquipSlots[i].AddItem(viSpell);                                                   // update inventory slot
                                        st.MagicId  = viSpell.attributes.Find(ia => ia.name.ToString() == "MagicID").value;  // grab the magic id
                                        st.ManaCost = viSpell.attributes.Find(ia => ia.name.ToString() == "ManaCost").value; // grab the mana cost
                                        st.EquipDisplay.AddItem(viSpell);                                                    // update the slot with the spell icon
                                    }
                                }
                            }
                        }
#endif
                    }
                }

                // order recalc
                LevelingSystem.reCalcCore(true);

                // return scene to load
                return(SceneName);
            }
            catch (Exception ex)
            {
                if (GlobalFuncs.DEBUGGING_MESSAGES)
                {
                    Debug.Log("LoadPlayerState(" + LevelingSystem.Name + "," + SaveGameID.ToString() + ") " + ex.Message);
                }
                return("");
            }
            finally
            {  // ensure clean up happens, even on error
                CleanUp();
            }
        }