Minor cleanup.

This commit is contained in:
NathanSweet 2013-09-26 09:36:23 +02:00
parent 2df28f8564
commit 98bf05c305
4 changed files with 18 additions and 18 deletions

View File

@ -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];
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}
}
}