From ed9bf64c03bf5fee5e115645de5a975baaa9041d Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期五, 09 一月 2026 11:04:53 +0800
Subject: [PATCH] 125 战斗 修改死亡表现 带动作的子技能同时触发导致的卡死

---
 Main/System/Battle/Motion/MotionBase.cs |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/Main/System/Battle/Motion/MotionBase.cs b/Main/System/Battle/Motion/MotionBase.cs
index 673ddbd..87bddfe 100644
--- a/Main/System/Battle/Motion/MotionBase.cs
+++ b/Main/System/Battle/Motion/MotionBase.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using UnityEngine;
 using Spine.Unity;
+using Cysharp.Threading.Tasks;
 
 public class MotionBase
 {
@@ -64,6 +65,7 @@
 
         PlayAnimation(MotionName.idle, true);
         SetupAnimationHandlers();
+        skillTrack = null;
         
         if (skelAnim.gameObject != null)
             illusionShadow = skelAnim.gameObject.AddMissingComponent<SkeletonIllusionShadow>();
@@ -173,6 +175,9 @@
         return ExecuteSkillAnim(skillConfig, skillBase, onComplete, targetAnim, true, isSubSkill);
     }
 
+    private Spine.TrackEntry skillTrack = null;
+
+
     private Spine.TrackEntry ExecuteSkillAnim(SkillConfig skillConfig, SkillBase skillBase, Action onComplete,
         Spine.Animation targetAnim, bool hasAnim, bool isSubSkill)
     {
@@ -215,10 +220,22 @@
             }
         }
         
-        Spine.TrackEntry skillTrack = null;
         
         if (hasAnim)
         {
+            if (null != skillTrack)
+            {
+                //绛夊緟涓婁竴鎶�鑳藉姩鐢荤粨鏉� 鏆傛椂澶勭悊鍔炴硶
+                UniTaskExtension.DelayFrames((GameObject)null, 1, () =>
+                {
+                    if (skillBase != null && !skillBase.IsFinished())
+                    {
+                        PlaySkillAnimation(skillConfig, skillBase, isSubSkill, onComplete);
+                    }
+                });
+                return null;
+            }
+
             skillTrack = animState.SetAnimation(trackIndex, targetAnim, false);
             if (null == skillTrack)
             {
@@ -441,6 +458,7 @@
                     RemoveAction(frameHandler);
                     onComplete?.Invoke();
                     skillBase.OnFinalFrameEnd();
+                    skillTrack = null;
                 }
             }
         };
@@ -599,6 +617,8 @@
             availableSubTracks.Enqueue(i);
 
         currentTrack = null;
+
+        skillTrack = null;
         
         playingSkillAnim = false;
         PlayAnimation(MotionName.idle, true);
@@ -657,7 +677,7 @@
             skeleton.SetToSetupPose();
             // skeleton.UpdateWorldTransform();
         }
-        
+        skillTrack = null;
         // 10. 鎾斁寰呮満鍔ㄧ敾
         PlayAnimation(MotionName.idle, true);
         skeletonAnim.LateUpdate();
@@ -678,4 +698,9 @@
         }
     }
 
+    public bool CanCastSkill()
+    {
+        //  涓婃閲婃斁鐨勬妧鑳� 閲婃斁缁撴潫浜嗘病鏈�
+        return !playingSkillAnim;
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0