void SpellAction(Action slot) { if (characterStats._stamina < slot.staminaCost) { return; } if (slot.spellClass != inventoryManager.currentSpell.instance.spellClass || characterStats._focus < slot.focusCost) { PlayAnimation("cant_spell", slot.mirror); return; } ActionInput inp = actionManager.GetActionInput(this); if (inp == ActionInput.lb) { inp = ActionInput.rb; } if (inp == ActionInput.lt) { inp = ActionInput.rt; } Spell s_inst = inventoryManager.currentSpell.instance; SpellAction s_slot = s_inst.GetAction(s_inst.spellActions, inp); if (s_slot == null) { return; } SpellEffectManager.singleton.UseSpellEffect(s_inst.spell_effect, this); isSpellCasting = true; spellCastTime = 0; maxSpellCastTime = s_slot.castTime; spellTargetAnim = s_slot.throwAnim; spellIsMirrored = slot.mirror; curSpellType = s_inst.spellType; string targetAnim = s_slot.targetAnim; if (spellIsMirrored) { targetAnim += StaticStrings._l; } else { targetAnim += StaticStrings._r; } projectileCandidate = inventoryManager.currentSpell.instance.projectile; inventoryManager.CreateSpellParticle(inventoryManager.currentSpell, spellIsMirrored, s_inst.spellType == SpellType.looping); anim.SetBool(StaticStrings.spellCasting, true); anim.SetBool(StaticStrings.mirror, slot.mirror); anim.CrossFade(targetAnim, 0.2f); curFocusCost = s_slot.focusCost; curStaminaCost = s_slot.staminaCost; a_hook.InitIKForBreathSpell(spellIsMirrored); if (spellCast_Start != null) { spellCast_Start(); } }
void SpellAction(Action slot) { if (characterStats.currentStamina < slot.staminaCost) { return; } if (slot.spellClass != inventoryManager.currentSpell.Instance.spellClass || characterStats.currentMana < slot.manaCost) { //Failed to cast spell Debug.Log("Cant cast spell!"); PlayAnimation(StaticStrings.animState_CantCastSpell, slot.mirror); return; } ActionInput inp = actionManager.GetActionInput(this); if (inp == ActionInput.lb) { inp = ActionInput.rb; } if (inp == ActionInput.lt) { inp = ActionInput.rt; } Spell spellInst = inventoryManager.currentSpell.Instance; SpellAction spellSlot = spellInst.GetAction(spellInst.actions, inp); if (spellSlot == null) { Debug.Log("CAN'T FIND SPELL SLOT"); return; } SpellEffectManager.Instance.UseSpellEffect(spellInst.spellEffect, this); isSpellCasting = true; spellCastTime = 0; max_SpellCastTime = spellSlot.castTime; spellTargetAnim = spellSlot.throwAnim; spellIsMirorred = slot.mirror; currentSpellType = spellInst.spellType; string targetAnim = spellSlot.targetAnim; if (spellIsMirorred) { targetAnim += StaticStrings._leftPrefix; } else { targetAnim += StaticStrings._rightPrefix; } projectileCandidate = inventoryManager.currentSpell.Instance.projectile; //If spellIsMirorred == true --> Left hand inventoryManager.CreateSpellParticle(inventoryManager.currentSpell, spellIsMirorred, (spellInst.spellType == SpellType.Looping)); animator.SetBool(StaticStrings.animParam_SpellCasting, true); animator.SetBool(StaticStrings.animParam_Mirror, slot.mirror); PlayAnimation(targetAnim); currentManaCost = spellSlot.manaCost; currentStaminaCost = spellSlot.staminaCost; animHook.InitIKForBreathSpell(spellIsMirorred); if (spellCastStart != null) { spellCastStart(); } }