| | |
| | | return currentTrack; |
| | | } |
| | | |
| | | public virtual Spine.TrackEntry PlayDeadAnimation(Action onComplete = null) |
| | | { |
| | | if (animState == null) return null; |
| | | |
| | | // 使用轨道9作为死亡动画专用轨道(独立于主轨道0和子技能轨道1-8) |
| | | const int deathTrackIndex = 9; |
| | | |
| | | // 清除死亡轨道上的回调 |
| | | if (activeSkillTracks.TryGetValue(deathTrackIndex, out var oldDeathTrack)) |
| | | { |
| | | if (trackEntryCallbacks.ContainsKey(oldDeathTrack)) |
| | | trackEntryCallbacks.Remove(oldDeathTrack); |
| | | } |
| | | |
| | | Spine.Animation deadAnim = FindAnim(MotionName.dead.ToString()); |
| | | if (deadAnim == null) |
| | | { |
| | | Debug.LogError("找不到死亡动画"); |
| | | onComplete?.Invoke(); |
| | | return null; |
| | | } |
| | | |
| | | Spine.TrackEntry deathTrack = animState.SetAnimation(deathTrackIndex, deadAnim, false); |
| | | |
| | | if (deathTrack != null) |
| | | { |
| | | activeSkillTracks[deathTrackIndex] = deathTrack; |
| | | |
| | | if (onComplete != null) |
| | | trackEntryCallbacks[deathTrack] = onComplete; |
| | | } |
| | | |
| | | return deathTrack; |
| | | } |
| | | |
| | | private void AddAction(Action action) => runningActions.Add(action); |
| | | private void RemoveAction(Action action) => runningActions.Remove(action); |
| | | |