FiniteStateMachine& FiniteStateMachine::update() { if (needToTriggerEnter) { currentState->enter(); needToTriggerEnter = false; } if (currentState != nextState){ immediateTransitionTo(*nextState); } currentState->update(); return *this; }
FiniteStateMachine& FiniteStateMachine::update() { //simulate a transition to the first state //this only happens the first time update is called if (needToTriggerEnter) { currentState->enter(); needToTriggerEnter = false; } else { if (currentState != nextState){ immediateTransitionTo(*nextState); } currentState->update(); } return *this; }
FiniteStateMachine& FiniteStateMachine::update() { //simulate a transition to the first state //this only happens the first time update is called if (needToTriggerEnter) { stateChangeTime = millis(); // Reset The Time to coincide with call to ENTER currentState->enter(); needToTriggerEnter = false; } else { if (currentState != nextState){ immediateTransitionTo(*nextState); } currentState->update(); } return *this; }