/** * Transition this state from terminating to detached. Should be invoked * only by a subclass or by the AppStateManager. Invoked once for each time * {@link #initialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)} * is invoked. */ public void cleanup() { if (debugAppState != null) { stateManager.detach(debugAppState); debugAppState = null; } stopPhysics(); }
/** * Transition this state from terminating to detached. Should be invoked * only by a subclass or by the AppStateManager. Invoked once for each time * {@link #initialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)} * is invoked. */ public void cleanup() { if (debugAppState != null) { stateManager.detach(debugAppState); debugAppState = null; } stopPhysics(); }
@Override public void simpleUpdate(float tpf) { if(stateManager.getState(TestState.class) != null) { System.out.println("Detaching test state."); stateManager.detach(stateManager.getState(TestState.class)); System.out.println("Done"); } }
@Override public void simpleUpdate(float tpf) { if (frame % 4 == 0) { System.out.println(++count); bulletAppState = new BulletAppState(); bulletAppState.setThreadingType(ThreadingType.PARALLEL); stateManager.attach(bulletAppState); } else if (frame % 4 == 2) { stateManager.detach(bulletAppState); } frame++; if (count == 70) { System.exit(0); } } }
@Override public void simpleInitApp() { stateManager.detach(stateManager.getState(FlyCamAppState.class)); stateManager.detach(stateManager.getState(ResetStatsState.class)); stateManager.detach(stateManager.getState(DebugKeysAppState.class)); stateManager.detach(stateManager.getState(StatsAppState.class)); final Node jaime = LoadModel(); setupLights(); setupCamera(); setupFloor(); setupCinematic(jaime); setupInput(); }
private void checkActiveChild(Vector3f vector3f) { AppStateManager stateManager = application.getStateManager(); if(vector3f == null){ if(currentActiveChild != null){ logger.log(Level.INFO, "Detach child {0}", currentActiveChild); stateManager.detach(currentActiveChild); currentActiveChild = null; } return; } if (currentActiveChild == null) { currentActiveChild = new InceptionLevel(this, vector3f); stateManager.attach(currentActiveChild); logger.log(Level.INFO, "Attach child {0}", currentActiveChild); } else if (!currentActiveChild.getPositionInParent().equals(vector3f)) { logger.log(Level.INFO, "Switching from child {0}", currentActiveChild); stateManager.detach(currentActiveChild); currentActiveChild = new InceptionLevel(this, vector3f); stateManager.attach(currentActiveChild); logger.log(Level.INFO, "Attach child {0}", currentActiveChild); } }
/** * Update this state prior to rendering. Should be invoked only by a * subclass or by the AppStateManager. Invoked once per frame, provided the * state is attached and enabled. * * @param tpf the time interval between frames (in seconds, ≥0) */ public void update(float tpf) { if (debugEnabled && debugAppState == null && pSpace != null) { debugAppState = new BulletDebugAppState(pSpace); stateManager.attach(debugAppState); } else if (!debugEnabled && debugAppState != null) { stateManager.detach(debugAppState); debugAppState = null; } if (!active) { return; } pSpace.distributeEvents(); this.tpf = tpf; }
/** * Update this state prior to rendering. Should be invoked only by a * subclass or by the AppStateManager. Invoked once per frame, provided the * state is attached and enabled. * * @param tpf the time interval between frames (in seconds, ≥0) */ public void update(float tpf) { if (debugEnabled && debugAppState == null && pSpace != null) { debugAppState = new BulletDebugAppState(pSpace); stateManager.attach(debugAppState); } else if (!debugEnabled && debugAppState != null) { stateManager.detach(debugAppState); debugAppState = null; } if (!active) { return; } pSpace.distributeEvents(); this.tpf = tpf; }
@Override public void cleanup() { super.cleanup(); //detach everything when we are detached application.getRootNode().detachChild(rootNode); application.getStateManager().detach(physicsState); cleanupData(); }
logger.log(Level.INFO, "Give over to child {0}", currentActiveChild); currentActiveChild.takeOverParent(); stateManager.detach(this); currentReturnLevel = currentActiveChild; return;
stateManager.detach(stateManager.getState(FlyCamAppState.class));
public void disconnect() { logger.info("disconnect()"); closing = true; logger.info("Detaching ConnectionState"); stateManager.detach(this); }
public void cleanup() { if (debugAppState != null) { stateManager.detach(debugAppState); debugAppState = null; } stopPhysics(); }
@Override public void interruptCommand(Application app) { Logger.getLogger(getClass().getName()).info("Video recording stopped"); VideoRenderAppState videoAppState = app.getStateManager() .getState(VideoRenderAppState.class); if (videoAppState != null) { app.getStateManager().detach(videoAppState); } }
@Override public void runCommand(Application app) { Logger.getLogger(getClass().getName()).info("Video recording stopped"); VideoRenderAppState videoAppState = app.getStateManager() .getState(VideoRenderAppState.class); if (videoAppState != null) { app.getStateManager().detach(videoAppState); } setState(State.Success); }
@Override protected void onPlayingEnd() { app.getStateManager().detach(MovieState.this); MovieState.this.onPlayingEnd(); }
private <T extends AppState> void pauseAppState(Class<T> appStateClass) { T appState = app.getStateManager().getState(appStateClass); if (appState != null) { app.getStateManager().detach(appState); } }
@Override public void onKeyEvent(KeyInputEvent evt) { if (evt.isPressed()) { if (evt.getKeyCode() == KeyInput.KEY_SPACE || evt.getKeyCode() == KeyInput.KEY_ESCAPE) { // FIXME: Space to debriefing & ESC to continue stateManager.detach(this); playerState.quitToDebriefing(); } } }
public void saveScreenshot(MouseButtonEvent evt, boolean isToggle) { phatScreenshotAppState.setFileName(fileNameTextField.getText()); phatScreenshotAppState.setFilePath(filePathTextField.getText()); phatScreenshotAppState.saveScreenshot(); app.getStateManager().detach(this); }
@Override public void cleanup() { app.getGuiNode().detachChild(keeperHand.getNode()); app.getInputManager().removeRawInputListener(inputListener); selectionHandler.cleanup(); CheatState cheatState = this.stateManager.getState(CheatState.class); if (cheatState != null) { this.stateManager.detach(cheatState); } super.cleanup(); }