@ -39,8 +39,6 @@ import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter ;
import com.jme3.export.JmeExporter ;
import com.jme3.export.JmeImporter ;
import com.jme3.export.JmeImporter ;
import com.jme3.export.OutputCapsule ;
import com.jme3.export.OutputCapsule ;
import com.jme3.system.NanoTimer ;
import com.jme3.system.Timer ;
import java.io.IOException ;
import java.io.IOException ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.List ;
import java.util.List ;
@ -59,12 +57,8 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
protected float initialDuration = 10 ;
protected float initialDuration = 10 ;
protected LoopMode loopMode = LoopMode . DontLoop ;
protected LoopMode loopMode = LoopMode . DontLoop ;
protected float time = 0 ;
protected float time = 0 ;
protected Timer timer ;
protected boolean resuming = false ;
protected float start = 0 ;
/ * *
* the last time the event was paused
* /
protected float elapsedTimePause = 0 ;
/ * *
/ * *
* the list of listeners
* the list of listeners
* /
* /
@ -108,12 +102,6 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
public void play ( ) {
public void play ( ) {
onPlay ( ) ;
onPlay ( ) ;
playState = PlayState . Playing ;
playState = PlayState . Playing ;
if ( timer = = null ) {
//only when used as a control
timer = new NanoTimer ( ) ;
}
start = timer . getTimeInSeconds ( ) ;
//timer.reset();
if ( listeners ! = null ) {
if ( listeners ! = null ) {
for ( int i = 0 ; i < listeners . size ( ) ; i + + ) {
for ( int i = 0 ; i < listeners . size ( ) ; i + + ) {
CinematicEventListener cel = listeners . get ( i ) ;
CinematicEventListener cel = listeners . get ( i ) ;
@ -133,7 +121,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
* /
* /
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 ) ;
//time = elapsedTimePause + (timer.getTimeInSeconds() - start) * speed;
//time = elapsedTimePause + (timer.getTimeInSeconds() - start) * speed;
onUpdate ( tpf ) ;
onUpdate ( tpf ) ;
@ -157,7 +145,6 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
onStop ( ) ;
onStop ( ) ;
time = 0 ;
time = 0 ;
playState = PlayState . Stopped ;
playState = PlayState . Stopped ;
elapsedTimePause = 0 ;
if ( listeners ! = null ) {
if ( listeners ! = null ) {
for ( int i = 0 ; i < listeners . size ( ) ; i + + ) {
for ( int i = 0 ; i < listeners . size ( ) ; i + + ) {
CinematicEventListener cel = listeners . get ( i ) ;
CinematicEventListener cel = listeners . get ( i ) ;
@ -177,7 +164,6 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
public void pause ( ) {
public void pause ( ) {
onPause ( ) ;
onPause ( ) ;
playState = PlayState . Paused ;
playState = PlayState . Paused ;
elapsedTimePause = time ;
if ( listeners ! = null ) {
if ( listeners ! = null ) {
for ( int i = 0 ; i < listeners . size ( ) ; i + + ) {
for ( int i = 0 ; i < listeners . size ( ) ; i + + ) {
CinematicEventListener cel = listeners . get ( i ) ;
CinematicEventListener cel = listeners . get ( i ) ;
@ -291,8 +277,6 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
* @param cinematic
* @param cinematic
* /
* /
public void initEvent ( Application app , Cinematic cinematic ) {
public void initEvent ( Application app , Cinematic cinematic ) {
timer = app . getContext ( ) . getTimer ( ) ;
//timer = new NanoTimer();
}
}
/ * *
/ * *
@ -327,10 +311,7 @@ public abstract class AbstractCinematicEvent implements CinematicEvent {
* @param time the time to fast forward to
* @param time the time to fast forward to
* /
* /
public void setTime ( float time ) {
public void setTime ( float time ) {
elapsedTimePause = time / speed ;
this . time = time / speed ;
if ( playState = = PlayState . Playing ) {
start = timer . getTimeInSeconds ( ) ;
}
}
}
public float getTime ( ) {
public float getTime ( ) {