Example #1
0
        public Spell GetSpell(string id)
        {
            SpellItemScriptableObject obj = Resources.Load("Retake.SpellItemScriptableObject") as SpellItemScriptableObject;

            if (obj == null)
            {
                Debug.Log("Retake.SpellItemScriptableObject could not be loaded!");
                return(null);
            }

            int index = GetSpellIdFromString(id);

            if (index == -1)
            {
                return(null);
            }

            return(obj.spell_Items[index]);
        }
Example #2
0
        void LoadSpellIds()
        {
            SpellItemScriptableObject obj = Resources.Load("Retake.SpellItemScriptableObject") as SpellItemScriptableObject;

            if (obj == null)
            {
                Debug.Log("Retake.SpellItemScriptableObject could not be loaded!");
                return;
            }

            for (int i = 0; i < obj.spell_Items.Count; i++)
            {
                if (Spell_ids.ContainsKey(obj.spell_Items[i].itemName))
                {
                    Debug.Log(obj.spell_Items[i].itemName + "item is a duplicate");
                }
                else
                {
                    Spell_ids.Add(obj.spell_Items[i].itemName, i);
                }
            }
        }