Package com.jme3.cinematic.events
Class CameraEvent
java.lang.Object
com.jme3.cinematic.events.AbstractCinematicEvent
com.jme3.cinematic.events.CameraEvent
- All Implemented Interfaces:
CinematicEvent
,Savable
A `CameraEvent` is a cinematic event that instantly sets the active camera
within a `Cinematic` sequence.
-
Field Summary
Fields inherited from class com.jme3.cinematic.events.AbstractCinematicEvent
initialDuration, listeners, loopMode, playState, resuming, speed, time
-
Constructor Summary
ConstructorsConstructorDescriptionFor serialization only.CameraEvent
(Cinematic cinematic, String cameraName) Constructs a new `CameraEvent` with the specified cinematic and camera name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Implement this method if the event needs different handling when stopped naturally (when the event reach its end), or when it was force-stopped during playback.Returns the name of the camera that this event will activate.Returns the `Cinematic` instance associated with this event.void
initEvent
(Application app, Cinematic cinematic) Initialize this event (called internally only).void
onPause()
Implement this method with code that you want to execute when the event is paused.void
onPlay()
Implement this method with code that you want to execute when the event is started.void
onStop()
Implement this method with code that you want to execute when the event is stopped.void
onUpdate
(float tpf) Implement this method with the code that you want to execute on update (only called when the event is playing).void
play()
Play this event.void
read
(JmeImporter im) Used internally for deserialization.void
setCameraName
(String cameraName) Sets the name of the camera that this event will activate.void
setCinematic
(Cinematic cinematic) Sets the `Cinematic` instance for this event.void
setTime
(float time) Fast-forwards the event to the given timestamp.void
write
(JmeExporter ex) Used internally for serialization.Methods inherited from class com.jme3.cinematic.events.AbstractCinematicEvent
addListener, dispose, getDuration, getInitialDuration, getLoopMode, getPlayState, getSpeed, getTime, internalUpdate, pause, removeListener, setInitialDuration, setLoopMode, setSpeed, stop
-
Constructor Details
-
CameraEvent
public CameraEvent()For serialization only. Do not use. -
CameraEvent
Constructs a new `CameraEvent` with the specified cinematic and camera name.- Parameters:
cinematic
- The `Cinematic` instance this event belongs to (cannot be null).cameraName
- The name of the camera to be activated by this event (cannot be null or empty).
-
-
Method Details
-
initEvent
Description copied from class:AbstractCinematicEvent
Initialize this event (called internally only).- Specified by:
initEvent
in interfaceCinematicEvent
- Overrides:
initEvent
in classAbstractCinematicEvent
- Parameters:
app
- ignoredcinematic
- ignored
-
play
public void play()Description copied from class:AbstractCinematicEvent
Play this event.- Specified by:
play
in interfaceCinematicEvent
- Overrides:
play
in classAbstractCinematicEvent
-
onPlay
public void onPlay()Description copied from class:AbstractCinematicEvent
Implement this method with code that you want to execute when the event is started.- Specified by:
onPlay
in classAbstractCinematicEvent
-
onUpdate
public void onUpdate(float tpf) Description copied from class:AbstractCinematicEvent
Implement this method with the code that you want to execute on update (only called when the event is playing).- Specified by:
onUpdate
in classAbstractCinematicEvent
- Parameters:
tpf
- time per frame
-
onStop
public void onStop()Description copied from class:AbstractCinematicEvent
Implement this method with code that you want to execute when the event is stopped.- Specified by:
onStop
in classAbstractCinematicEvent
-
onPause
public void onPause()Description copied from class:AbstractCinematicEvent
Implement this method with code that you want to execute when the event is paused.- Specified by:
onPause
in classAbstractCinematicEvent
-
forceStop
public void forceStop()Description copied from class:AbstractCinematicEvent
Implement this method if the event needs different handling when stopped naturally (when the event reach its end), or when it was force-stopped during playback. By default, this method just calls regular stop().- Specified by:
forceStop
in interfaceCinematicEvent
- Overrides:
forceStop
in classAbstractCinematicEvent
-
setTime
public void setTime(float time) Description copied from class:AbstractCinematicEvent
Fast-forwards the event to the given timestamp. Time=0 is the start of the event.- Specified by:
setTime
in interfaceCinematicEvent
- Overrides:
setTime
in classAbstractCinematicEvent
- Parameters:
time
- the time to fast-forward to.
-
getCinematic
Returns the `Cinematic` instance associated with this event.- Returns:
- The `Cinematic` instance.
-
setCinematic
Sets the `Cinematic` instance for this event.- Parameters:
cinematic
- The `Cinematic` instance to set (cannot be null).
-
getCameraName
Returns the name of the camera that this event will activate.- Returns:
- The camera name.
-
setCameraName
Sets the name of the camera that this event will activate.- Parameters:
cameraName
- The new camera name (cannot be null or empty).
-
write
Used internally for serialization.- Specified by:
write
in interfaceSavable
- Overrides:
write
in classAbstractCinematicEvent
- Parameters:
ex
- The exporter (not null).- Throws:
IOException
- If an I/O error occurs during serialization.
-
read
Used internally for deserialization.- Specified by:
read
in interfaceSavable
- Overrides:
read
in classAbstractCinematicEvent
- Parameters:
im
- The importer (not null).- Throws:
IOException
- If an I/O error occurs during deserialization.
-