Beispiel #1
0
    public void SetSpell(int id, AvailableSpells aSpell)
    {
        if (id >= GetMaxSpells() || id < 0)
        {
            id = 0;
        }

        // Every spell must have an script attached here
        Spell spell;

        switch (aSpell)
        {
        case AvailableSpells.SPELL_FIREBALL:
            spell = gameObject.AddComponent <Fireball>();
            break;

        // Return if spell does not exist
        default:
            Debug.Log("Tried setting spell " + aSpell + "at id " + ", but does not exist.");
            return;
        }

        Spells[id] = spell;

        MyUI.SetSpellIcon(id, spell.GetIcon());
    }