125 【战斗】战斗系统 修复技能播放偶尔会出现死循环的bug
| | |
| | | |
| | | public virtual void Hurt(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig) |
| | | { |
| | | PopDamage(damageValues, _totalDamage, hurt, skillConfig); |
| | | BattleDmgInfo dmgInfo = PopDamage(damageValues, _totalDamage, hurt, skillConfig); |
| | | |
| | | motionBase.PlayAnimation(MotionName.hit, false); |
| | | |
| | | if (dmgInfo.IsType(DamageType.Damage) || dmgInfo.IsRealdamage()) |
| | | { |
| | | motionBase.PlayAnimation(MotionName.hit, false); |
| | | } |
| | | } |
| | | |
| | | public void SuckHp(uint suckHP, SkillConfig skillConfig) |
| | |
| | | } |
| | | |
| | | // 伤害还要看 是否闪避 暴击 and so on 需要有一个DamageType 服务器应该会给 |
| | | protected virtual void PopDamage(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig) |
| | | protected virtual BattleDmgInfo PopDamage(List<long> damageValues, long _totalDamage, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt, SkillConfig skillConfig) |
| | | { |
| | | BattleDmgInfo battleDmgInfo = new BattleDmgInfo(battleField.guid, damageValues, this, hurt, skillConfig); |
| | | |
| | |
| | | |
| | | // YYL TODO 是否需要挂在在自身的follow点上 |
| | | EventBroadcast.Instance.Broadcast(EventName.BATTLE_DAMAGE_TAKEN, battleDmgInfo); |
| | | return battleDmgInfo; |
| | | } |
| | | |
| | | public RectTransform GetAliasTeamNode() |
| | |
| | | { |
| | | if (trackEntryCompleteDict.TryGetValue(currentTrackEntry, out var __onComplete)) |
| | | { |
| | | __onComplete?.Invoke(); |
| | | trackEntryCompleteDict.Remove(currentTrackEntry); |
| | | __onComplete?.Invoke(); |
| | | } |
| | | currentTrackEntry = null; |
| | | } |
| | |
| | | // 只调用本次TrackEntry的回调 |
| | | if (trackEntryCompleteDict.TryGetValue(trackEntry, out var cb)) |
| | | { |
| | | cb?.Invoke(); |
| | | trackEntryCompleteDict.Remove(trackEntry); |
| | | cb?.Invoke(); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public virtual void Run() |
| | | { |
| | | // #if UNITY_EDITOR |
| | | // List<int> removeIndex = new List<int>(); |
| | | // #endif |
| | | for (int i = runActionList.Count - 1; i >= 0; i--) |
| | | { |
| | | runActionList[i]?.Invoke(); |
| | | // #if UNITY_EDITOR |
| | | // try |
| | | // { |
| | | // #endif |
| | | runActionList[i]?.Invoke(); |
| | | // #if UNITY_EDITOR |
| | | // } |
| | | // catch (System.Exception ex) |
| | | // { |
| | | // removeIndex.Add(i); |
| | | // BattleDebug.LogError($"执行RunAction时发生异常: {ex.Message}\n{ex.StackTrace}"); |
| | | // } |
| | | // #endif |
| | | } |
| | | |
| | | // #if UNITY_EDITOR |
| | | // // 移除失败的Action |
| | | // for (int i = 0; i < removeIndex.Count; i++) |
| | | // { |
| | | // runActionList.RemoveAt(removeIndex[i]); |
| | | // } |
| | | // #endif |
| | | } |
| | | |
| | | public virtual void Pause() |
| | |
| | | // battleField.battleTweenMgr.OnPlayTween(tweener); |
| | | } |
| | | |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, Action onComplete = null) |
| | | protected void MoveToTarget(RectTransform target, Vector2 offset, Action _onComplete = null) |
| | | { |
| | | // 原地释放 |
| | | if (skillConfig.CastDistance >= 9999) |
| | | { |
| | | onComplete?.Invoke(); |
| | | _onComplete?.Invoke(); |
| | | return; |
| | | } |
| | | |
| | |
| | | var tweener = BattleUtility.MoveToTarget(caster.heroRectTrans, target, offset, () => |
| | | { |
| | | caster.motionBase.PlayAnimation(MotionName.idle, true); |
| | | onComplete?.Invoke(); |
| | | _onComplete?.Invoke(); |
| | | }); |
| | | battleField.battleTweenMgr.OnPlayTween(tweener); |
| | | } |
| | |
| | | TurnBack( |
| | | () => |
| | | { |
| | | RectTransform rectTransform = battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum); |
| | | // 回到原来的位置 |
| | | MoveToTarget(battleField.GetTeamNode(caster.Camp, caster.teamHero.positionNum), Vector2.zero, |
| | | OnAttackFinish); |
| | | MoveToTarget(rectTransform, Vector2.zero, OnAttackFinish); |
| | | } |
| | | , -1f); |
| | | }); |
| | |
| | | protected virtual void OnHitEachTarget(int _hitIndex, BattleObject target, HB427_tagSCUseSkill.tagSCUseSkillHurt hurt) |
| | | { |
| | | // 伤害分布 (万分比) |
| | | // Debug.LogError("skillConfig.DamageDivide.Count " + skillConfig.DamageDivide.Length + " _hitIndex " + _hitIndex); |
| | | int[] damageDivide = skillConfig.DamageDivide[_hitIndex]; |
| | | |
| | | long totalDamage = GeneralDefine.GetFactValue(hurt.HurtHP, hurt.HurtHPEx); |