I see how FSM provides nice exiting/entering/changed notifications, but it looks like they're synchronous - in real life that sequence would happen nearly instantaneously, correct? From StateMachine.as -> transitionTo:
// Exit the current State
if ( currentState && currentState.exiting ) sendNotification( currentState.exiting, data, nextState.name );
// Check to see whether the transition has been canceled
if ( canceled ) {
canceled = false;
return;
}
// Enter the next State
if ( nextState.entering ) sendNotification( nextState.entering, data );
currentState = nextState;
// Send the notification configured to be sent when this specific state becomes current
if ( nextState.changed ) sendNotification( currentState.changed, data );
// Notify the app generally that the state changed and what the new state is
sendNotification( CHANGED, currentState, currentState.name );
In my app, I need to handle transitions visually by tweening properties over time. This means exiting the current state could take 1.2 seconds, entering the next state takes 1.5 seconds, and maybe I want them to overlap by 0.4 seconds. And maybe I want "changed" to fire .2 seconds before the entering transition is done. Possible with FSM or not?
thanks.