Updated Event in anticipation of AnimationState changes.

This commit is contained in:
NathanSweet 2016-01-21 11:37:19 +01:00
parent c333b84740
commit cf01d47796
3 changed files with 11 additions and 5 deletions

View File

@ -92,8 +92,8 @@ public class EventTimelineTests {
float lastFrame = -1; float lastFrame = -1;
for (int i = 0; i < eventCount; i++) { for (int i = 0; i < eventCount; i++) {
float frame = frames[i]; float frame = frames[i];
Event event = new Event(new EventData("" + events[i])); Event event = new Event(frame, new EventData("" + events[i]));
timeline.setFrame(i, frame, event); timeline.setFrame(i, event);
maxFrame = Math.max(maxFrame, frame); maxFrame = Math.max(maxFrame, frame);
if (lastFrame != frame) distinctCount++; if (lastFrame != frame) distinctCount++;
lastFrame = frame; lastFrame = frame;

View File

@ -543,8 +543,8 @@ public class Animation {
} }
/** Sets the time of the specified keyframe. */ /** Sets the time of the specified keyframe. */
public void setFrame (int frameIndex, float time, Event event) { public void setFrame (int frameIndex, Event event) {
frames[frameIndex] = time; frames[frameIndex] = event.time;
events[frameIndex] = event; events[frameIndex] = event;
} }

View File

@ -36,8 +36,10 @@ public class Event {
int intValue; int intValue;
float floatValue; float floatValue;
String stringValue; String stringValue;
final float time;
public Event (EventData data) { public Event (float time, EventData data) {
this.time = time;
this.data = data; this.data = data;
} }
@ -65,6 +67,10 @@ public class Event {
this.stringValue = stringValue; this.stringValue = stringValue;
} }
public float getTime () {
return time;
}
public EventData getData () { public EventData getData () {
return data; return data;
} }