Пример #1
0
    /// <summary>
    /// 主动技能的入口函数,涉及到有弹道,回调
    /// </summary>
    public static void ActiveSkillWork(FightUnit attacker, FightUnit target, ActiveSkill skill)
    {
        switch ((SkillCurve)skill.normalSkill.curve)
        {
        case SkillCurve.None:
        case SkillCurve.Melee:
            ActiveSkillSelect(attacker, target, skill);
            break;

        case SkillCurve.Directional:
            GameObject obj = ProjectileMove.CreateProjectile(skill.name + "_" + attacker.mTrans.name, attacker.mTrans.parent, skill.flyEffectFromPos, skill.flyEffect.speed, target.Body, delegate(SpecialEffect fx)
            {
                ActiveSkillSelect(attacker, target, skill);
            });
            skill.StartCoroutine(skill.DisplayFlyEffect(obj.transform));
            break;

        case SkillCurve.Parabola:
            Vector3 targetPos;
            bool    isHeroSkill = attacker.parentGroup.group == FightGroup.GroupType.Mine;
            if (skill.flyEffect.distance > 0)
            {
                targetPos = attacker.mTrans.localPosition + (isHeroSkill? -1 : 1) * Vector3.right * skill.flyEffect.distance;
            }
            else
            {
                targetPos = target.mTrans.localPosition + target.Body.localPosition;
            }
            GameObject obj_1 = ProjectileMove.CreateProjectile(skill.name, attacker.mTrans.parent, skill.flyEffectFromPos, skill.flyEffect.speed, skill.flyEffect.height, targetPos, delegate(SpecialEffect fx)
            {
                ActiveSkillSelect(attacker, target, skill);
            });
            if (!isHeroSkill)
            {
                obj_1.AddComponent <DragRecord>();
            }
            skill.StartCoroutine(skill.DisplayFlyEffect(obj_1.transform));
            break;

        case SkillCurve.Magica:
            if (skill.dmgEffect == null)
            {
                return;
            }
            if (skill.dmgEffect.target == 4 || skill.dmgEffect.target == 5)
            {
                skill.StartCoroutine(AcitveSkillMagic_Whole(attacker, target, skill));
            }
            else
            {
                ActiveSkillSelect(attacker, target, skill);
            }
            break;

        case SkillCurve.LineAoe:
            bool isRight = (attacker.parentGroup.group == FightGroup.GroupType.Mine && !attacker.isConfused) ||
                           (attacker.parentGroup.group == FightGroup.GroupType.Enemy && attacker.isConfused);
            GameObject obj_2 = LineAoeMove.CreateLineAoe(skill.name + "_" + attacker.mTrans.name, attacker.mTrans.parent, skill.flyEffectFromPos, skill.flyEffect.speed, isRight, delegate(FightUnit unit)
            {
                ActiveSkillDamage(attacker, unit, skill);
            });
            skill.StartCoroutine(skill.DisplayFlyEffect(obj_2.transform));
            break;
        }
    }