Java Code Examples for com.jme3.app.state.AppStateManager#attach()

The following examples show how to use com.jme3.app.state.AppStateManager#attach() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldOfInception.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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);
    }
}
 
Example 2
Source File: BulletAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Transition this state from detached to initializing. Should be invoked
 * only by a subclass or by the AppStateManager.
 *
 * @param stateManager (not null)
 */
@Override
public void stateAttached(AppStateManager stateManager) {
    super.stateAttached(stateManager);
    if (!isRunning) {
        startPhysics();
    }
    if (threadingType == ThreadingType.PARALLEL) {
        PhysicsSpace.setLocalThreadPhysicsSpace(pSpace);
    }
    if (debugEnabled) {
        debugAppState = new BulletDebugAppState(pSpace);
        stateManager.attach(debugAppState);
    }
}
 
Example 3
Source File: VRApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void initStateManager(){
    stateManager = new AppStateManager(this);

    // Always register a ResetStatsState to make sure
    // that the stats are cleared every frame
    stateManager.attach(new ResetStatsState());
}
 
Example 4
Source File: LegacyApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void initStateManager(){
    stateManager = new AppStateManager(this);

    // Always register a ResetStatsState to make sure
    // that the stats are cleared every frame
    stateManager.attach(new ResetStatsState());
}
 
Example 5
Source File: SceneEditor3DPart.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@JmeThread
private void addAppStateImpl(@NotNull final SceneAppState appState) {
    final AppStateManager stateManager = EditorUtil.getStateManager();
    stateManager.attach(appState);
}