public static void DeepCopySpellAction(SpellAction to, SpellAction from) { to.input = from.input; to.targetAnim = from.targetAnim; to.throwAnim = from.throwAnim; to.castTime = from.castTime; to.staminaCost = from.staminaCost; to.focusCost = from.focusCost; }
public static void DeepCopySpell(Spell from, Spell to) { to.itemName = from.itemName; to.itemDescription = from.itemDescription; to.icon = from.icon; to.spellType = from.spellType; to.spellClass = from.spellClass; to.projectile = from.projectile; to.spell_effect = from.spell_effect; to.particle_prefab = from.particle_prefab; to.actions = new List <SpellAction>(); for (int i = 0; i < from.actions.Count; i++) { SpellAction a = new SpellAction(); DeepCopySpellAction(a, from.actions[i]); to.actions.Add(a); } }
void SpellAction(Action slot) { if (characterStats._stamina < slot.staminaCost) { return; } if (slot.spellClass != inventoryManager.currentSpell.instance.spellClass || characterStats._focus < slot.focusCost) { anim.SetBool(StaticStrings.mirror, slot.mirror); anim.CrossFade("cant_spell", 0.2f); canAttack = false; canMove = false; inAction = true; 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.actions, inp); if (s_slot == null) { Debug.Log("Cant find spell slot"); return; } SpellEffectManager.singleton.UseSpellEffect(s_inst.spell_effect, this); projectileCanidate = inventoryManager.currentSpell.instance.projectile; isSpellcasting = true; spellcastTime = 0; max_spellCastTime = 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; } 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); cur_focusCost = s_slot.focusCost; cur_stamCost = s_slot.staminaCost; a_Hook.IniIKForBreathSpell(spellIsMirrored); if (spellCast_start != null) { spellCast_start(); } }