Fixed an issue with cinematic that was causing the first frame of the cinematic to not be rendered.

Also fix some static constant calls the non static way in MotionPath
This commit is contained in:
Nehon 2014-10-20 15:09:38 +02:00
parent e15b86d0ba
commit 9cd1a514a6
2 changed files with 9 additions and 7 deletions

View File

@ -328,11 +328,6 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
*/ */
@Override @Override
public void onUpdate(float tpf) { public void onUpdate(float tpf) {
for (int i = 0; i < cinematicEvents.size(); i++) {
CinematicEvent ce = cinematicEvents.get(i);
ce.internalUpdate(tpf);
}
int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time); int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time);
//iterate to make sure every key frame is triggered //iterate to make sure every key frame is triggered
@ -343,6 +338,13 @@ public class Cinematic extends AbstractCinematicEvent implements AppState {
} }
} }
for (int i = 0; i < cinematicEvents.size(); i++) {
CinematicEvent ce = cinematicEvents.get(i);
ce.internalUpdate(tpf);
}
lastFetchedKeyFrame = keyFrameIndex; lastFetchedKeyFrame = keyFrameIndex;
} }

View File

@ -171,10 +171,10 @@ public class MotionEvent extends AbstractCinematicEvent implements Control {
public void internalUpdate(float tpf) { public void internalUpdate(float tpf) {
if (playState == PlayState.Playing) { if (playState == PlayState.Playing) {
time = time + (tpf * speed); time = time + (tpf * speed);
if (loopMode == loopMode.Loop && time < 0) { if (loopMode == LoopMode.Loop && time < 0) {
time = initialDuration; time = initialDuration;
} }
if ((time >= initialDuration || time < 0) && loopMode == loopMode.DontLoop) { if ((time >= initialDuration || time < 0) && loopMode == LoopMode.DontLoop) {
if (time >= initialDuration) { if (time >= initialDuration) {
path.triggerWayPointReach(path.getNbWayPoints() - 1, this); path.triggerWayPointReach(path.getNbWayPoints() - 1, this);
} }