Exemplo n.º 1
0
 public static void DeepCopySpellAction(SpellAction to, SpellAction from)
 {
     to.input           = from.input;
     to.targetAnimation = from.targetAnimation;
     to.throwAnimation  = from.throwAnimation;
     to.castTime        = from.castTime;
     to.manaCost        = from.manaCost;
     to.staminaCost     = from.staminaCost;
 }
Exemplo n.º 2
0
        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.spell_Actions = new List <SpellAction>();
            for (int i = 0; i < from.spell_Actions.Count; i++)
            {
                SpellAction action = new SpellAction();
                DeepCopySpellAction(action, from.spell_Actions[i]);
                to.spell_Actions.Add(action);
            }
        }
Exemplo n.º 3
0
        void SpellAction(Action slot)
        {
            if (slot.spellClass != inventoryManager.currentSpell.instance.spellClass ||
                characterStats._stamina < slot.staminaCost || characterStats._mana < slot.manaCost)
            {
                anim.SetBool(StaticStrings.mirror, slot.mirror);
                anim.CrossFade("cant_spell", 0.2f);
                canAttack = false;
                onEmpty   = 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.GetSpellAction(s_inst.spell_Actions, inp);

            if (s_slot == null)
            {
                Debug.Log("Cant find spell slot");
                return;
            }

            SpellEffectsManager.singleton.UseSpellEffect(s_inst.spell_effect, this);

            isSpellcasting    = true;
            spellcastTime     = 0;
            max_spellcastTime = s_slot.castTime;
            spellTargetAnim   = s_slot.throwAnimation;
            spellIsMirrored   = slot.mirror;
            curSpellType      = s_inst.spellType;

            string targetAnim = s_slot.targetAnimation;

            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);

            cur_manaCost = s_slot.manaCost;
            cur_stamCost = s_slot.staminaCost;

            a_hook.InitIKForBreathSpell(spellIsMirrored);

            if (spellCast_start != null)
            {
                spellCast_start();
            }
        }