/// <summary> /// Uses the selected spell on the target (if any). /// Different effects depending on type. /// </summary> /// <param name="target"></param> /// <param name="spellIndex"></param> public void UseSpell(int target, int spellIndex) { Debug.Log("Used magic no " + spellIndex + " on the enemy!"); Spell spell = spells[spellIndex].reference; cooldowns[spellIndex] = spell.Cooldown(spells[spellIndex].level); playerController.LoseMana(spell.ManaCost(spells[spellIndex].level)); switch (spell.spellType) { case Spell.SpellType.SINGLE: enemyController.TakeMagicDamage(target, spell.Damage(spells[spellIndex].level), spell.Stuns(spells[spellIndex].level)); break; case Spell.SpellType.HEAL: playerController.HealDamage(spell.Heal(spells[spellIndex].level)); break; case Spell.SpellType.FAMILIAR: playerController.CreateFamiliar(spell.Heal(spells[spellIndex].level)); break; } UpdateSpells(); }