public Spell GetSpell(string itemName) { SpellItemScriptableObject obj = Resources.Load("AW.SpellItemScriptableObject") as SpellItemScriptableObject; int index = GetSpellIdFromString(itemName); if (index == -1) { Debug.Log("get spell null!"); return(null); } return(obj.spell_items[index]); }
private void LoadSpellIds() { SpellItemScriptableObject obj = Resources.Load("AW.SpellItemScriptableObject") as SpellItemScriptableObject; if (obj == null) { Debug.Log("could't find AW.SpellItemScriptableObject"); 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 duplicae"); } else { spell_Ids.Add(obj.spell_items[i].itemName, i); } } }