Class FixedSM
Abstract state machine to manage a set of given states and transitions.
Implements
Namespace: nickmaltbie.StateMachineUnity.Fixed
Assembly: cs.temp.dll.dll
Syntax
public abstract class FixedSM : IStateMachine<Type>
Constructors
FixedSM()
Initializes a state machine and will set the initial state to the state defined under this class with an InitialStateAttribute.
Declaration
public FixedSM()
Properties
CurrentState
Current state of the state machine.
Declaration
public Type CurrentState { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
RaiseEvent(IEvent)
Raise a synchronous event for a given state machine.
First checks if this state machine expects any events of this type
for the state machine's CurrentState. These
would follow an attribute of type OnEventDoActionAttribute.
If the state machine's CurrentState expects a transition
based on the event, then this will trigger the OnExitStateAttribute
of the CurrentState, change to the next state defined in
the TransitionAttribute, then trigger the OnEnterStateAttribute
of the next state.
Declaration
public void RaiseEvent(IEvent evt)
Parameters
Type | Name | Description |
---|---|---|
IEvent | evt | Event to send to this state machine. |
SetStateQuiet(Type)
Internal method to set the current state of the state machine without invoking the OnEnterStateAttribute or OnExitStateAttribute
Declaration
public void SetStateQuiet(Type newState)
Parameters
Type | Name | Description |
---|---|---|
Type | newState | New state to set for the state machine. |