| Class TStateAware (unit State) |
Class definition for a state-aware object.
| Constructors |
constructor Create;| Functions |
procedure AddToStateSequence(enumNewState: enumState; fValue1, fValue2: Real);
procedure ClearStateSequence;
destructor Destroy;
procedure ExitCurrentState;
procedure Move;
function bIsInState(enumStateToTest: enumState): Boolean;
function bIsProcessingState: Boolean;
procedure DeactivateCurrentState;
procedure EnterState(pstCurrent: PState);
procedure ExitState(pstCurrent: PState);
procedure ProcessState(pstCurrent: PState);
function stGetCurrentState: enumState;| Properties |
| Events |
| Variables |
m_bPendingStateExit : Boolean;
m_bProcessingState : Boolean;
m_bStatesPending : Boolean;
m_lstPendingStates : TList;
m_stCurrent : PState;| Constructors |
constructor Create;Class constructor and destructor.
TRUE when one or more states is pending.
| Functions |
procedure AddToStateSequence(enumNewState: enumState; fValue1, fValue2: Real);Methods to respond to commands in the state queue.
Release our state queue.
procedure ClearStateSequence;Record that the object is now actively listening to states.
destructor Destroy;Initialize the pending state queue and current state flag.
procedure ExitCurrentState;Iterate through and remove each state tracking structure in the queue.
procedure Move;Virtual method called to process pending states.
Note: A maximum of one state change will occur during each iteration. Derived classes use this information to perform further processing.
function bIsInState(enumStateToTest: enumState): Boolean;If the entire pause interval has passed, then end the pause.
function bIsProcessingState: Boolean;Informational methods.
procedure DeactivateCurrentState;Routine to deactivate the currently active state.
Process the exit on the next movement.
procedure EnterState(pstCurrent: PState);Virtual methods for customizing state behavior.
We are now processing a command.
procedure ExitState(pstCurrent: PState);Record time of pause start.
procedure ProcessState(pstCurrent: PState);
function stGetCurrentState: enumState;| Properties |
| Events |
| Variables |
m_bPendingStateExit : Boolean;TRUE when we're processing command.
m_bProcessingState : Boolean;Command currently being processed.
m_bStatesPending : Boolean;TRUE when the current state has an exit pending.
m_lstPendingStates : TList;
m_stCurrent : PState;Queue of pending commands.