| | |
| | | { |
| | | const float moveTime = 0.5f; |
| | | |
| | | private static readonly Color colorGreen = new Color(33f / 255f, |
| | | 133f / 255f, |
| | | 6f / 255f); |
| | | private static readonly Color colorBlue = new Color(40f / 255f, |
| | | 87f / 255f, |
| | | 189f / 255f); |
| | | |
| | | protected SkillEffect skillEffect; |
| | | protected HB427_tagSCUseSkill tagUseSkillAttack; |
| | | public SkillConfig skillConfig; |
| | |
| | | protected bool moveFinished = false; |
| | | public int fromSkillId; |
| | | public bool isPlay = false; |
| | | |
| | | private float MoveSpeed = 750f; |
| | | |
| | | private Dictionary<int, BattleDrops> tempDropList = new Dictionary<int, BattleDrops>(); |
| | | private Dictionary<int, HB422_tagMCTurnFightObjDead> tempDeadPackList = new Dictionary<int, HB422_tagMCTurnFightObjDead>(); |
| | |
| | | } |
| | | } |
| | | |
| | | protected void ShadowIllutionCreate(bool create) |
| | | { |
| | | if (create) |
| | | { |
| | | Color color = Color.white; |
| | | //1-连击;2-反击;3-追击 |
| | | // 反击蓝色 |
| | | // 追击连击绿色 |
| | | bool change = false; |
| | | if (tagUseSkillAttack.BattleType == 1) |
| | | { |
| | | color = colorGreen; |
| | | change = true; |
| | | } |
| | | else if (tagUseSkillAttack.BattleType == 2) |
| | | { |
| | | color = colorBlue; |
| | | change = true; |
| | | } |
| | | else if (tagUseSkillAttack.BattleType == 3) |
| | | { |
| | | color = colorGreen; |
| | | change = true; |
| | | } |
| | | |
| | | if (change) |
| | | { |
| | | MoveSpeed = 1125f; |
| | | caster.motionBase.ShowIllusionShadow(true, color); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | MoveSpeed = 750f; |
| | | caster.motionBase.ShowIllusionShadow(false); |
| | | } |
| | | } |
| | | |
| | | // 技能释放主逻辑:广播事件、高亮目标、执行释放 |
| | | public virtual void Cast() |
| | | { |
| | |
| | | if (hintConfig != null) |
| | | { |
| | | caster.heroInfoBar.ShowTips(((char)hintConfig.prefix).ToString(), true); |
| | | // Debug.Break(); |
| | | } |
| | | } |
| | | |
| | |
| | | RectTransform target = battleField.GetTeamNode(caster.GetEnemyCamp(), skillConfig); |
| | | ExecuteMoveAndCastSequence(target, () => |
| | | { |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, OnAttackFinish, 750F); |
| | | // ShadowIllutionCreate(true); |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () => |
| | | { |
| | | // ShadowIllutionCreate(false); |
| | | OnAttackFinish(); |
| | | }, MoveSpeed); |
| | | }); |
| | | } |
| | | |
| | |
| | | ExecuteMoveAndCastSequence(targetTrans, () => |
| | | { |
| | | RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum); |
| | | MoveToTarget(rectTransform, Vector2.zero, OnAttackFinish, 750F); |
| | | // ShadowIllutionCreate(true); |
| | | MoveToTarget(rectTransform, Vector2.zero, () => |
| | | { |
| | | // ShadowIllutionCreate(false); |
| | | OnAttackFinish(); |
| | | }, MoveSpeed); |
| | | }); |
| | | } |
| | | |
| | |
| | | RectTransform target = battleField.GetTeamNode(caster.Camp, skillConfig); |
| | | ExecuteMoveAndCastSequence(target, () => |
| | | { |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, OnAttackFinish, 750F); |
| | | // ShadowIllutionCreate(true); |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, () => |
| | | { |
| | | // ShadowIllutionCreate(false); |
| | | OnAttackFinish(); |
| | | }, MoveSpeed); |
| | | }); |
| | | } |
| | | |
| | | // 执行移动-施法-返回序列:通用的移动攻击流程 |
| | | private void ExecuteMoveAndCastSequence(RectTransform target, Action onReturnComplete) |
| | | { |
| | | ShadowIllutionCreate(true); |
| | | MoveToTarget(target, new Vector2(skillConfig.CastDistance, 0), () => |
| | | { |
| | | TurnBack(() => |
| | | { |
| | | ShadowIllutionCreate(false); |
| | | CastImpl(() => |
| | | { |
| | | TurnBack(() => |
| | |
| | | } |
| | | |
| | | // 移动到目标位置:处理角色的移动动画和逻辑 |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 500f) |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null, float speed = 750f) |
| | | { |
| | | if (skillConfig.CastDistance >= 9999) |
| | | { |
| | |
| | | public void OnSkillFinished() |
| | | { |
| | | // 修复:使用循环代替递归,避免栈溢出风险 |
| | | try |
| | | { |
| | | // try |
| | | // { |
| | | while (true) |
| | | { |
| | | // 验证技能效果是否完成 |
| | |
| | | } |
| | | |
| | | if (pack is CustomB421ActionPack actionPack) |
| | | { |
| | | actionPack.Distribute(); |
| | | } |
| | | else |
| | | { |
| | | PackageRegedit.Distribute(pack); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Debug.LogError($"OnSkillFinished异常: {ex.Message},技能ID={skillConfig.SkillID}"); |
| | | // 确保状态一致性,即使出现异常也要标记完成 |
| | | isFinished = true; |
| | | throw; // 重新抛出异常供上层处理 |
| | | } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // Debug.LogError($"OnSkillFinished异常: {ex.Message},技能ID={skillConfig.SkillID}"); |
| | | // // 确保状态一致性,即使出现异常也要标记完成 |
| | | // isFinished = true; |
| | | // throw; // 重新抛出异常供上层处理 |
| | | // } |
| | | |
| | | isFinished = true; |
| | | } |