Engine - ThiagoDAraujoS/CSharp-State-Machine GitHub Wiki
Core object that represents the state machine instance.
public class Example {
Engine stateMachine;
public Example(){
stateMachine = new Engine("state machine name", this);
}
public void Update(){
stateMachine.Run();
}
[Initial][StateFrom("state machine name")]
public class FirstState : State{
}
}
Constructor
public Engine( string Name, Object Owner );
Parameters
- Name is the unique name Id for the state machine system bound to this object type, it must be unique unless in the case of inherited states machines. An object type can have more than one state machine systems with different names bound to it.
- Owner a reference to the object owning this state machine.
Public Methods
Run
public void Run();
Steps forward the state machine's state.
Every time this method is called, the current state resolves its Update method and then its links are checked; in case of a state swap, the End and Start methods of the old and new states are also called.