Exemple #1
0
    //Spells

    public Spell GetSpell(string id)
    {
        SpellItemScriptableObject obj = Resources.Load("SpellItemScriptableObject") as SpellItemScriptableObject;

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

        int index = GetIndexFromString(spellIds, id);

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

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

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

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