StateMachineTLabel Class |
Namespace: Gamelogic.Extensions
[VersionAttribute(1, 0, 0)] public class StateMachine<TLabel>
The StateMachineTLabel type exposes the following members.
Name | Description | |
---|---|---|
StateMachineTLabel |
Constructs a new StateMachine.
|
Name | Description | |
---|---|---|
CurrentState |
Returns the label of the current state.
|
Name | Description | |
---|---|---|
AddState(TLabel) |
Adds a state.
| |
AddState(TLabel, Action) |
Adds a state, and the delegates that should run
when the state starts.
Any delegate can be null, and wont be executed.
| |
AddState(TLabel, Action, Action) |
Adds a state, and the delegates that should run
when the state starts,
and when the state machine is updated.
Any delegate can be null, and wont be executed.
| |
AddState(TLabel, Action, Action, Action) |
Adds a state, and the delegates that should run
when the state starts, stops,
and when the state machine is updated.
Any delegate can be null, and wont be executed.
| |
AddStateTSubStateLabel(TLabel, StateMachineTSubStateLabel, TSubStateLabel) |
Adds a sub state machine for the given state.
The sub state machine need not be updated, as long as this state machine
is being updated.
| |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
ToString |
Returns the current state name
(Overrides ObjectToString.) | |
Update |
This method should be called every frame.
|
Name | Description | |
---|---|---|
ThrowIfNull |
Throws a NullReferenceException if the object is null.
(Defined by ObjectExtensions.) |
To use it:
When a state is changed, the OnStop on existing state is called, then the OnStart of the new state, and from there on OnUpdate of the new state each time the update is called.