diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index 55ffb357e..eea852b7b 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -76,10 +76,10 @@ namespace Spine { TrackEntry next = current.next; if (next != null && time >= next.delay) { - if (next.animation == null) - Clear(i); - else + if (next.animation != null) SetCurrent(i, next); + else + Clear(i); } } } @@ -204,7 +204,7 @@ namespace Spine { if (delay <= 0) { if (last != null) { delay += last.endTime; - if (animation != null) delay += -data.GetMix(last.animation, animation); + if (animation != null) delay -= data.GetMix(last.animation, animation); } else delay = 0; } @@ -214,7 +214,7 @@ namespace Spine { } /** @return May be null. */ - public TrackEntry getTrackEntry (int trackIndex) { + public TrackEntry getCurrent (int trackIndex) { if (trackIndex >= tracks.Count) return null; return tracks[trackIndex]; } diff --git a/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index 43c674c31..fdd634185 100644 --- a/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -73,10 +73,10 @@ public class AnimationState { TrackEntry next = current.next; if (next != null && time >= next.delay) { - if (next.animation == null) - clear(i); - else + if (next.animation != null) setCurrent(i, next); + else + clear(i); } } } @@ -227,7 +227,7 @@ public class AnimationState { if (delay <= 0) { if (last != null) { delay += last.endTime; - if (animation != null) delay += -data.getMix(last.animation, animation); + if (animation != null) delay -= data.getMix(last.animation, animation); } else delay = 0; } @@ -237,7 +237,7 @@ public class AnimationState { } /** @return May be null. */ - public TrackEntry getTrackEntry (int trackIndex) { + public TrackEntry getCurrent (int trackIndex) { if (trackIndex >= tracks.size) return null; return tracks.get(trackIndex); } diff --git a/spine-libgdx/test/com/esotericsoftware/spine/AnimationStateTest.java b/spine-libgdx/test/com/esotericsoftware/spine/AnimationStateTest.java index bbee02001..e5c7fe9a9 100644 --- a/spine-libgdx/test/com/esotericsoftware/spine/AnimationStateTest.java +++ b/spine-libgdx/test/com/esotericsoftware/spine/AnimationStateTest.java @@ -70,19 +70,19 @@ public class AnimationStateTest extends ApplicationAdapter { state = new AnimationState(stateData); state.addListener(new AnimationStateListener() { public void event (int trackIndex, Event event) { - System.out.println(trackIndex + " event: " + state.getTrackEntry(trackIndex) + ", " + event.getData().getName()); + System.out.println(trackIndex + " event: " + state.getCurrent(trackIndex) + ", " + event.getData().getName()); } public void complete (int trackIndex, int loopCount) { - System.out.println(trackIndex + " complete: " + state.getTrackEntry(trackIndex) + ", " + loopCount); + System.out.println(trackIndex + " complete: " + state.getCurrent(trackIndex) + ", " + loopCount); } public void start (int trackIndex) { - System.out.println(trackIndex + " start: " + state.getTrackEntry(trackIndex)); + System.out.println(trackIndex + " start: " + state.getCurrent(trackIndex)); } public void end (int trackIndex) { - System.out.println(trackIndex + " end: " + state.getTrackEntry(trackIndex)); + System.out.println(trackIndex + " end: " + state.getCurrent(trackIndex)); } }); state.setAnimation(0, "walk", true); diff --git a/spine-xna/example/src/ExampleGame.cs b/spine-xna/example/src/ExampleGame.cs index 62675dfcd..e5a6c97e1 100644 --- a/spine-xna/example/src/ExampleGame.cs +++ b/spine-xna/example/src/ExampleGame.cs @@ -150,19 +150,19 @@ namespace Spine { } public void Start (object sender, StartEndArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getTrackEntry(e.TrackIndex) + ": start"); + Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": start"); } public void End (object sender, StartEndArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getTrackEntry(e.TrackIndex) + ": end"); + Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": end"); } public void Complete (object sender, CompleteArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getTrackEntry(e.TrackIndex) + ": complete " + e.LoopCount); + Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": complete " + e.LoopCount); } public void Event (object sender, EventTriggeredArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getTrackEntry(e.TrackIndex) + ": event " + e.Event); + Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": event " + e.Event); } } }