コード例 #1
0
    public static GameObject CreateLineAoe(string goName, Transform parent, Vector3 goPos, float xSpeed, bool isRight, HitHandler callBack)
    {
        GameObject obj = new GameObject(goName);

        obj.transform.parent        = parent;
        obj.transform.localScale    = Vector3.one;
        obj.transform.localPosition = goPos;
        LineAoeMove move = obj.AddComponent <LineAoeMove>();

        move.xSpeed = xSpeed;
        move.direct = isRight ? Vector3.right : -Vector3.right;
        FightGroup targetGroup = isRight ? (FightGroup)FightManager.GetInstance().enemyGroup : FightManager.GetInstance().mineGroup;

        move.ToHitUnits = new List <FightUnit>(targetGroup.fightUnits);
        move.OnHit      = callBack;
        return(obj);
    }
コード例 #2
0
ファイル: FightRule.cs プロジェクト: zgq974751608/OurGame
    /// <summary>
    /// 绝技的入口函数,涉及到有弹道,回调
    /// </summary>
    public static void UniqueSkillWork(FightUnit attacker, FightUnit target, UniqueSkill skill)
    {
        switch ((SkillCurve)skill.specialSkill.curve)
        {
        case SkillCurve.None:
        case SkillCurve.Melee:
            UniqueSkillSelect(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)
            {
                UniqueSkillSelect(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)
            {
                UniqueSkillSelect(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(UniqueSkillMagic_Whole(attacker, target, skill));
            }
            else
            {
                UniqueSkillSelect(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)
            {
                UniqueSkillDamage(attacker, unit, skill);
            });
            skill.StartCoroutine(skill.DisplayFlyEffect(obj_2.transform));
            break;
        }
    }