예제 #1
0
 public static void DeepCopySpellAction(SpellAction from, SpellAction to)
 {
     to.targetAnim = from.targetAnim;
     to.castTime   = from.castTime;
     to.input      = from.input;
     to.throwAnim  = from.throwAnim;
 }
예제 #2
0
        private void SpellAction(Action slot)
        {
            if (slot.spellClass != inventoryManager.currentSpell.instance.spellClass)
            {
                Debug.Log("Spell Class doesn't match");
                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_slots = s_inst.GetAction(s_inst.actions, inp);

            if (s_slots == null)
            {
                Debug.Log("can not find spell slot");
                return;
            }

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

            isSpellCasting   = true;
            spellcastTime    = 0;
            maxSpellcastTime = s_slots.castTime;
            spellTargetAnim  = s_slots.throwAnim;
            spellMirror      = slot.mirror;
            curSpellType     = s_inst.spellType;

            string targetAnim = s_slots.targetAnim;

            if (spellMirror)
            {
                targetAnim += "_l";
            }
            else
            {
                targetAnim += "_r";
            }
            anim.SetBool(StaticStrings.spellcasting, true);
            anim.SetBool(StaticStrings.mirror, spellMirror);
            projectileCanidate = inventoryManager.currentSpell.instance.projectile;
            inventoryManager.CreateSpellPartcle(inventoryManager.currentSpell, spellMirror, s_inst.spellType == SpellType.looping);
            anim.CrossFade(targetAnim, 0.2f);

            if (spellcast_start != null)
            {
                spellcast_start();
            }
        }
예제 #3
0
        public static void DeepCopySpell(Spell from, Spell to)
        {
            to.spellType       = from.spellType;
            to.spellClass      = from.spellClass;
            to.particlePrefab  = from.particlePrefab;
            to.projectile      = from.projectile;
            to.icon            = from.icon;
            to.itemDescription = from.itemDescription;
            to.itemName        = from.itemName;
            to.spell_effect    = from.spell_effect;

            to.actions = new List <SpellAction>();
            for (int i = 0; i < from.actions.Count; i++)
            {
                SpellAction a = new SpellAction();
                DeepCopySpellAction(from.actions[i], a);
                to.actions.Add(a);
            }
        }