示例#1
0
        public Spell GetSpell(string id)
        {
            SpellItemsScriptableObject obj = Resources.Load("SS.SpellItemsScriptableObject") as SpellItemsScriptableObject;

            if (obj == null)
            {
                Debug.Log("SpellItemsScriptableObject could not be loaded.");
                return(null);
            }
            int index = GetSpellIdFromString(id);

            if (index == -1)
            {
                return(null);
            }
            return(obj.spellItems[index]);
        }
示例#2
0
        void LoadSpellIds()
        {
            SpellItemsScriptableObject obj = Resources.Load("SS.SpellItemsScriptableObject") as SpellItemsScriptableObject;

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

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