Ejemplo n.º 1
0
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;
}
Ejemplo n.º 3
0
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;
}