bool CState::changeState(const string& state, CComponentParameter* parameter, bool force) { if (isStateLocked_) { return false; } if (!force) { if (currentState_.compare(state) == 0) { return false; } } if(!currentState_.empty()) { onLeaveState(currentState_); } currentState_ = state; onEnterState(currentState_); if (parameter) { setComponentParameter(parameter); } return true; }
void AppStage_ComputeTrackerPoses::setState(eMenuState newState) { if (newState != m_menuState) { onExitState(m_menuState); onEnterState(newState); m_menuState = newState; } }
//-- private methods ----- void AppStage_GyroscopeCalibration::setState(eCalibrationMenuState newState) { if (newState != m_menuState) { onExitState(m_menuState); onEnterState(newState); m_menuState = newState; } }
void StateMachine::perform(int state, float time) { //debugLog("in perform"); stateExtraDT = 0; prevState = currentState; nextState = state; //debugLog("onExitState"); // do this to prevent scripts from repeating endlessly when running main loops enqueuedState = STATE_NONE; onExitState(currentState); stateCounter = 0; stateTime = time; currentState = state; nextState = STATE_NONE; //debugLog("onActionInit"); onEnterState(currentState); //debugLog("done"); }