void UnequipSpell(SpellInputList slot) { if (equippedSpells[(int)slot] != null) { Debug.Log("Unequipped Spell: " + equippedSpells[(int)slot].name); equippedSpells[(int)slot] = null; } }
public bool CanCastSpell(SpellInputList slot) { // If we have a spell equipped to the given slot if (equippedSpells[(int)slot] != null) { // If that spell is ready if (equippedSpells[(int)slot].GetComponent <Spell>().isReady) { return(true); } } return(false); }
void EquipSpell(ColourList colour, int spellIndex, SpellInputList slot) { if (equippedSpells[(int)slot] != null) { UnequipSpell(slot); } int c = (int)colour; if (allSpells[c][spellIndex] != null) { if (allSpells[c][spellIndex].isLocked != true) { Debug.Log("EquippingSpell: " + allSpells[c][spellIndex].name); equippedSpells[(int)slot] = allSpells[c][spellIndex].gameObject; } } }
void CastSpell(SpellInputList slot) { // If we can cast a spell equipped in the slot if (_weaponController.CanCastSpell() && _spellManager.CanCastSpell(slot)) { float paintCost = _spellManager.equippedSpells[(int)slot].GetComponent <Spell>().paintCost; if (_paint >= paintCost) { TakePaintDamage(_spellManager.equippedSpells[(int)slot].GetComponent <Spell>().paintCost); _weaponController.CastSpell(_spellManager.equippedSpells[(int)slot]); } else { // TODO: Indicate that the player cannot cast a spell Debug.Log("NO PAINT! CAN'T CAST SPELL"); } } }