public void removeKeyFrame(int keyFrameIndex) { remove(keyFrameIndex); if (lastKeyFrameIndex == keyFrameIndex) { KeyFrame kf = null; for (int i = keyFrameIndex; kf == null && i >= 0; i--) { kf = getKeyFrameAtIndex(i); lastKeyFrameIndex = i; } } }
/** * enable the display of the path and the waypoints * @param manager the assetManager * @param rootNode the node where the debug shapes must be attached */ public void enableDebugShape(AssetManager manager, Node rootNode) { assetManager = manager; // computeTotalLentgh(); attachDebugNode(rootNode); }
public void onAction(String name, boolean isPressed, float tpf) { if(name.equals("start") && isPressed){ if(cinematic.getPlayState() != PlayState.Playing){ cinematic.play(); }else{ cinematic.pause(); } } } }, "start");
/** * removes the first occurrence found of the given cinematicEvent for the * given time stamp. * * @param timeStamp the timestamp when the cinematicEvent has been added * @param cinematicEvent the cinematicEvent to remove * @return true if the element has been removed */ public boolean removeCinematicEvent(float timeStamp, CinematicEvent cinematicEvent) { cinematicEvent.dispose(); KeyFrame keyFrame = timeLine.getKeyFrameAtTime(timeStamp); return removeCinematicEvent(keyFrame, cinematicEvent); }
public void checkWayPoint(MotionEvent control, float tpf) { //Epsilon varies with the tpf to avoid missing a waypoint on low framerate. float epsilon = tpf * 4f; if (control.getCurrentWayPoint() != prevWayPoint) { if (control.getCurrentValue() >= 0f && control.getCurrentValue() < epsilon) { triggerWayPointReach(control.getCurrentWayPoint(), control); prevWayPoint = control.getCurrentWayPoint(); } } }
/** * schedule an event that will activate the camera at the given time * * @param timeStamp the time to activate the cam * @param cameraName the camera name (as registered in * Cinematic#bindCamera()) */ public void activateCamera(final float timeStamp, final String cameraName) { addCinematicEvent(timeStamp, new CameraEvent(this, cameraName)); }
/** * called internally don't call it directly. * * @param tpf */ @Override public void update(float tpf) { if (isInitialized() && playState == PlayState.Playing) { internalUpdate(tpf); } }
public KeyFrame getKeyFrameAtTime(float time) { return get(getKeyFrameIndexFromTime(time)); }
public void removeKeyFrame(float time) { removeKeyFrame(getKeyFrameIndexFromTime(time)); }
public void addKeyFrameAtTime(float time, KeyFrame keyFrame) { addKeyFrameAtIndex(getKeyFrameIndexFromTime(time), keyFrame); }
/** * passing true has the same effect as play() you should use play(), * pause(), stop() to handle the cinematic playing state. * * @param enabled true or false */ public void setEnabled(boolean enabled) { if (enabled) { play(); } }
/** * called internally * * @param stateManager the state manager */ public void stateDetached(AppStateManager stateManager) { stop(); }
@Override public void onPlay() { cinematic.setActiveCamera(cameraName); }
public KeyFrame getKeyFrameAtIndex(int keyFrameIndex) { return get(keyFrameIndex); }
public float getKeyFrameTime(KeyFrame keyFrame) { return (float)keyFrame.getIndex()/(float)keyFramesPerSeconds; }
public Collection<KeyFrame> getAllKeyFrames() { return values(); }
@Override public void onPlay() { fade.setDuration(1f / cinematic.getSpeed()); if (in) { fade.fadeIn(); } else { fade.fadeOut(); } fade.setValue(value); }