Class StateMachine
Inheritance
MonoBehaviour
StateMachine
Assembly: cs.temp.dll.dll
Syntax
public class StateMachine : MonoBehaviour
Fields
ActiveState
Declaration
public MachineState ActiveState
Field Value
| Type |
Description |
| MachineState |
|
logStateChanges
Declaration
public bool logStateChanges
Field Value
| Type |
Description |
| System.Boolean |
|
NewState
Declaration
public MachineState NewState
Field Value
| Type |
Description |
| MachineState |
|
onStateChanged
Declaration
public UnityEvent onStateChanged
Field Value
| Type |
Description |
| UnityEvent |
|
Methods
InState(MachineState)
Defines current state the state machine is in
Declaration
public bool InState(MachineState state)
Parameters
| Type |
Name |
Description |
| MachineState |
state |
the current Machine State
|
Returns
| Type |
Description |
| System.Boolean |
|
Trigger(String)
This takes the name of a transition in the form of a string created on the Machine State and initiates the transition to the respective state.
Declaration
public void Trigger(string trigger)
Parameters
| Type |
Name |
Description |
| System.String |
trigger |
name given to the transition created in the respective Machine State
|
Trigger(String, Boolean)
Declaration
public void Trigger(string trigger, bool doImmediately = false)
Parameters
| Type |
Name |
Description |
| System.String |
trigger |
|
| System.Boolean |
doImmediately |
|
StateMachine usually waits for the next Update in order to change state and doImmediately allows us to force the change immediately.
Declaration
public void TriggerImmediately(string trigger)
Parameters
| Type |
Name |
Description |
| System.String |
trigger |
name given to the transition created in the respective Machine State
|
Events
OnStateChanged
Declaration
public event Action OnStateChanged
Event Type