| | |
| | | protected List<H0704_tagRolePackRefresh> dropPackList = new List<H0704_tagRolePackRefresh>(); |
| | | protected List<HB405_tagMCAddExp> expPackList = new List<HB405_tagMCAddExp>(); |
| | | |
| | | protected List<BattleDeadPack> endDeadPackList = new List<BattleDeadPack>(); |
| | | protected List<SkillRecordAction> waitingCastSkillRecordAction = new List<SkillRecordAction>(); |
| | | |
| | | |
| | | protected bool moveFinished = false; |
| | | public SkillBase fromSkill; |
| | | public bool isPlay = false; |
| | | |
| | | // 父RecordAction(SkillRecordAction),用于子技能建立父子关系 |
| | | protected RecordAction parentRecordAction; |
| | | |
| | | // 技能动画是否播放完成(针对有动画的技能) |
| | | protected bool isMotionCompleted = false; |
| | | |
| | | private float MoveSpeed = 750f; |
| | | |
| | |
| | | } |
| | | |
| | | SafetyCheck(); |
| | | #if UNITY_EDITOR |
| | | if (Launch.Instance.isOpenSkillLogFile) |
| | | { |
| | | PinrtHB427Hp(); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | // 设置父RecordAction |
| | | public void SetParentRecordAction(RecordAction recordAction) |
| | | { |
| | | parentRecordAction = recordAction; |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | |
| | | |
| | | private void SafetyCheck() |
| | | { |
| | | #if UNITY_EDITOR |
| | | if (Launch.Instance.isOpenSkillLogFile) |
| | | { |
| | | PinrtHB427Hp(); |
| | | } |
| | | #endif |
| | | |
| | | bool safety = caster != null |
| | | && skillConfig != null |
| | | && tagUseSkillAttack != null |
| | |
| | | |
| | | skillEffect = SkillEffectFactory.CreateSkillEffect(this, caster, skillConfig, tagUseSkillAttack); |
| | | skillEffect.Play(OnHitTargets); |
| | | ProcessSubSkill(); |
| | | HandleWaitingCastSkill(); |
| | | |
| | | isPlay = true; |
| | | } |
| | | |
| | | protected void ProcessSubSkill() |
| | | { |
| | | foreach (var subSkillPack in tagUseSkillAttack.subSkillList) |
| | | { |
| | | SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { subSkillPack }); |
| | | recordAction.fromSkill = this; |
| | | otherSkillActionList.Add(recordAction); |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction); |
| | | // 子技能设置WaitingPlay=true,等待父技能动作完成 |
| | | waitingCastSkillRecordAction.Add(recordAction); |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true); |
| | | } |
| | | tagUseSkillAttack.subSkillList.Clear(); |
| | | foreach (var subCombinePack in tagUseSkillAttack.subSkillCombinePackList) |
| | | { |
| | | SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, subCombinePack.packList); |
| | | recordAction.fromSkill = this; |
| | | otherSkillActionList.Add(recordAction); |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction); |
| | | // 子技能设置WaitingPlay=true,等待父技能动作完成 |
| | | waitingCastSkillRecordAction.Add(recordAction); |
| | | } |
| | | tagUseSkillAttack.subSkillCombinePackList.Clear(); |
| | | |
| | | isPlay = true; |
| | | waitingCastSkillRecordAction.OrderBy(recordAction => recordAction.hB427_TagSCUseSkill.packUID); |
| | | |
| | | |
| | | } |
| | | |
| | | protected void HandleWaitingCastSkill() |
| | | { |
| | | RecordAction waitingRecordAction = null; |
| | | |
| | | for (int i = 0; i < waitingCastSkillRecordAction.Count; i++) |
| | | { |
| | | var recordAction = waitingCastSkillRecordAction[i]; |
| | | |
| | | if (waitingRecordAction != null) |
| | | { |
| | | // 每个都应该等前一个结束后 |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction, waitingRecordAction, true); |
| | | } |
| | | else |
| | | { |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true); |
| | | } |
| | | |
| | | if (recordAction.IsNeedWaiting()) |
| | | { |
| | | waitingRecordAction = recordAction; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 技能前摇结束回调 |
| | |
| | | // 技能后摇结束回调:通知技能效果处理后摇结束 |
| | | public virtual void OnFinalFrameEnd() |
| | | { |
| | | // 标记动画播放完成 |
| | | isMotionCompleted = true; |
| | | BattleDebug.LogError($"SkillBase.OnFinalFrameEnd: 技能 {skillConfig?.SkillID} 动画播放完成"); |
| | | |
| | | skillEffect?.OnFinalFrameEnd(); // 修复:添加空值检查 |
| | | } |
| | |
| | | #endif |
| | | |
| | | // 先调用目标受伤 |
| | | target.Hurt(hurtParam); |
| | | target.Hurt(hurtParam, parentRecordAction); |
| | | |
| | | // 再调用施法者吸血/反伤 |
| | | caster.OnHurtTarget(hurtParam); |
| | |
| | | return false; |
| | | } |
| | | |
| | | // 如果技能有动画(SkillMotionName不为空),需要等待动画播放完成 |
| | | if (skillConfig != null && !string.IsNullOrEmpty(skillConfig.SkillMotionName)) |
| | | { |
| | | if (!isMotionCompleted) |
| | | { |
| | | BattleDebug.LogError($"SkillBase.IsFinishedForJudge: 技能 {skillConfig.SkillID} 等待动画播放完成"); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | |
| | | { |
| | | battleField.RemoveCastingSkill(caster.ObjID, this); |
| | | |
| | | // 传递parentRecordAction,让死亡技能等待当前技能完成 |
| | | battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values)); |
| | | } |
| | | |
| | |
| | | battleField.RemoveCastingSkill(caster.ObjID, this); |
| | | } |
| | | |
| | | battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values)); |
| | | // 传递parentRecordAction,让死亡技能等待当前技能完成 |
| | | battleField.OnObjsDead(new List<BattleDeadPack>(tempDeadPackList.Values), parentRecordAction); |
| | | |
| | | // 1. 强制结束技能效果 |
| | | skillEffect?.ForceFinished(); |
| | |
| | | SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, new List<GameNetPackBasic>() { subSkillPack }); |
| | | recordAction.fromSkill = this; |
| | | otherSkillActionList.Add(recordAction); |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction); |
| | | // 子技能设置WaitingPlay=true,等待父技能动作完成 |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true); |
| | | } |
| | | tagUseSkillAttack.subSkillList.Clear(); |
| | | foreach (var subCombinePack in tagUseSkillAttack.subSkillCombinePackList) |
| | |
| | | SkillRecordAction recordAction = CustomHB426CombinePack.CreateSkillAction(battleField.guid, subCombinePack.packList); |
| | | recordAction.fromSkill = this; |
| | | otherSkillActionList.Add(recordAction); |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction); |
| | | // 子技能设置WaitingPlay=true,等待父技能动作完成 |
| | | battleField.recordPlayer.ImmediatelyPlay(recordAction, parentRecordAction, true); |
| | | } |
| | | tagUseSkillAttack.subSkillCombinePackList.Clear(); |
| | | |
| | |
| | | isFinished = true; |
| | | moveFinished = true; |
| | | isPlay = true; |
| | | |
| | | // 强制结束时,无论是否有动画,都标记动画完成 |
| | | isMotionCompleted = true; |
| | | |
| | | // 6. 处理所有剩余包(包括 buff 包) |
| | | // 先处理 buffPackCollections |
| | |
| | | } |
| | | } |
| | | |
| | | public virtual bool CanStartExecution() |
| | | { |
| | | if (null == caster) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (null == skillConfig) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(skillConfig.SkillMotionName)) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | return !battleField.IsCastingSkill(caster.ObjID); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |