yyl
2025-09-12 c5c6c915069a1f93d10ee3d2c897beca1e100c8d
Main/System/Battle/SkillEffect/BulletSkillEffect.cs
@@ -13,6 +13,7 @@
    protected List<BulletCurve> bulletCurves = new List<BulletCurve>();
    public BulletSkillEffect(SkillConfig _skillConfig, BattleObject _caster, HB427_tagSCUseSkill _tagUseSkillAttack)
        : base(_skillConfig, _caster, _tagUseSkillAttack)
    {
@@ -33,7 +34,7 @@
                Debug.LogError("目标为空 target == null ObjId : " + hurt.ObjID);
                return;
            }
            ShotToTarget(targetObject);
            ShotToTarget(targetObject, index);
        }
        //  普通的做法 区分打向阵营或者打向个体
        else
@@ -42,29 +43,29 @@
            if (skillConfig.Scattering == 1)
            {
                //  散射
                ShotEachTargets();
                ShotEachTargets(index);
            }
            else
            {
                switch (skillConfig.TagAim)
                {
                    case 0:
                        AllAreaShoting();
                        AllAreaShoting(index);
                        break;
                    case 1:
                        OneTargetShoting();
                        OneTargetShoting(index);
                        break;
                    case 2:
                        FrontRowShoting();
                        FrontRowShoting(index);
                        break;
                    case 3:
                        BackRowShoting();
                        BackRowShoting(index);
                        break;
                    case 4:
                        VerticalRowShoting();
                        VerticalRowShoting(index);
                        break;
                    case 5:
                        SelfShoting();
                        SelfShoting(index);
                        break;
                    default:
                        Debug.LogError("子弹特效没有配置正确的TagAim,强制结束子弹特效 TagAim: " + skillConfig.TagAim);
@@ -76,23 +77,23 @@
    }
    // 0   全部范围:
    private void AllAreaShoting()
    private void AllAreaShoting(int index)
    {
        if (skillConfig.TagCount == 0 || skillConfig.TagCount >= 6)
        {
            // 若TagCount目标个数为0或6,根据TagFriendly敌我配置,代表作用于敌方全体或我方全体,此时主目标为敌我站位中的2号位置
            BattleCamp battleCamp = skillConfig.TagFriendly != 0 ? caster.Camp : caster.GetEnemyCamp();
            ShotToIndex(battleCamp, 1);
            ShotToIndex(battleCamp, 1, index);
        }
        else
        {
            // 若TagCount目标个数为1~5个,代表随机作用于敌方或我方x个武将,此时所有被随机到的对象都为主目标(施法位置会用客户端配置)
            ShotEachTargets();
            ShotEachTargets(index);
        }   
    }
    // 1    对位:
    private void OneTargetShoting()
    private void OneTargetShoting(int index)
    {
        // 默认只选1个,对位规则为A1优先打B1,A2优先打B2,A3优先打B3,对位目标死亡时,优先前排,
        // 比如B2已经死亡,那么A2将优先打B1,前排1、2、3号位置全部死亡之后才开始选择后排4、5、6号位置,
@@ -110,11 +111,11 @@
            Debug.LogError("目标为空 target == null ObjId : " + hurt.ObjID);
            return;
        }
        ShotToTarget(targetObject);
        ShotToTarget(targetObject, index);
    }
    // 2    前排:
    private void FrontRowShoting()
    private void FrontRowShoting(int index)
    {
        // 1、2、3号位为前排,默认2号位置为主目标,当1、2、3号位置角色全部死亡,前排将替换成后排,5号位置变更为主目标,
        // 若配置TagAffect细分目标,且人数小于3,则所有被选择目标均为主目标(施法位置会用客户端配置)
@@ -124,7 +125,7 @@
        if (skillConfig.TagAffect != 0 && skillConfig.TagAffect != 3 && skillConfig.TagCount < 3)
        {
            ShotEachTargets();
            ShotEachTargets(index);
        }
        else
        {
@@ -158,19 +159,19 @@
                targetIndex = 1;
            }
            ShotToIndex(battleCamp, targetIndex);
            ShotToIndex(battleCamp, targetIndex, index);
        }
    }
    private void ShotToIndex(BattleCamp camp, int targetIndex)
    private void ShotToIndex(BattleCamp camp, int targetIndex, int bulletIndex)
    {
        RectTransform targetTransform = caster.battleField.GetTeamNode(camp, targetIndex);
        BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp);
        RectTransform effectTrans = effectPlayer.transform as RectTransform;
        var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, targetTransform, tagUseSkillAttack, (index, hitList) =>
        var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, targetTransform, tagUseSkillAttack, bulletIndex, (index, hitList) =>
        {
            if (isFinish)
                return;
@@ -205,7 +206,7 @@
    }
    // 3    后排:
    private void BackRowShoting()
    private void BackRowShoting(int index)
    {
        // 4、5、6号位为后排,默认5号位置为主目标,当4、5、6号位置角色全部死亡,后排排将替换成前排,2号位置变更为主目标,
        // 若配置TagAffect细分目标,且人数小于3,则所有被选择目标均为主目标(施法位置会用客户端配置)
@@ -215,7 +216,7 @@
        if (skillConfig.TagAffect != 0 && skillConfig.TagAffect != 3 && skillConfig.TagCount < 3)
        {
            ShotEachTargets();
            ShotEachTargets(index);
        }
        else
        {
@@ -249,12 +250,12 @@
                targetIndex = 4;
            }
            ShotToIndex(battleCamp, targetIndex);
            ShotToIndex(battleCamp, targetIndex, index);
        }
    }
    // 4    纵排:
    private void VerticalRowShoting()
    private void VerticalRowShoting(int index)
    {
        // 纵排分别为1、4,2、5,3、6,三组纵排,按对位规则选择,默认1号、2号或3号为主目标,前排1、2、3号位置全部死完后,4号、5号或6号为主目标
        BattleCamp battleCamp = skillConfig.TagFriendly != 0 ? caster.Camp : caster.GetEnemyCamp();
@@ -274,7 +275,7 @@
        if (minimumIndex != int.MaxValue)
        {
            ShotToIndex(battleCamp, minimumIndex);
            ShotToIndex(battleCamp, minimumIndex, index);
        }
        else
        {
@@ -286,17 +287,17 @@
    }
    // 5    自己:
    private void SelfShoting()
    private void SelfShoting(int index)
    {
        // 默认只选自己,自己为主目标
        ShotToIndex(caster.Camp, caster.teamHero.positionNum);
        ShotToIndex(caster.Camp, caster.teamHero.positionNum, index);
    }
    protected void ShotToTarget(BattleObject target)
    protected void ShotToTarget(BattleObject target, int bulletIndex)
    {
        BattleEffectPlayer effectPlayer = caster.battleField.battleEffectMgr.PlayEffect(caster.ObjID, skillConfig.BulletEffectId, caster.heroRectTrans, caster.Camp);
        var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans, tagUseSkillAttack, (index, hitList) =>
        var bulletCurve = BulletCurveFactory.CreateBulletCurve(caster, skillConfig, effectPlayer, target.heroRectTrans, tagUseSkillAttack, bulletIndex, (index, hitList) =>
        {
            if (isFinish)
                return;
@@ -320,9 +321,11 @@
            onHit?.Invoke(index, hitList);
            // 击中就销毁子弹
            caster.battleField.battleEffectMgr.RemoveEffect(skillConfig.BulletEffectId, effectPlayer);
            // 播放子弹爆炸特效
            isFinish = true;
            if (bulletIndex >= skillConfig.ActiveFrames.Length - 1)
            {
                isFinish = true;
            }
        });
        bulletCurves.Add(bulletCurve);
@@ -344,7 +347,7 @@
        }
    }
    private void ShotEachTargets()
    private void ShotEachTargets(int index)
    {
        for (int i = 0; i < tagUseSkillAttack.HurtList.Length; i++)
        {
@@ -355,7 +358,7 @@
                Debug.LogError("特效目标为空 target == null ObjId : " + hurt.ObjID);
                continue;
            }
            ShotToTarget(target);
            ShotToTarget(target, index);
        }
    }