This class defines a Finite State Machine (FSM).
FSMs break behaviours down into clearly defined states. Each state can run actions.
Actions can use variables defined by the FSM or global variables defined for the project.
Transitions between states are triggered by events.
Properties
Type | Property |
---|---|
GameObject | GameObject |
GameObject that owns the FSM. | |
MonoBehaviour | Owner [get, set] |
MonoBehaviour that owns the FSM. Can be cast to PlayMakerFSM. |
|
bool | Active [get] |
Is the FSM active? | |
bool | Finished [get] |
Has the FSM finished running? | |
string | Name [get, set] |
Descriptive name. | |
string | StartState [get, set] |
Name of the start state that is entered when the FSM is enabled. | |
FsmState[] | States [get, set] |
FsmStates defined by the FSM. | |
FsmEvent[] | Events [get, set] |
FsmEvents used by the FSM. | |
FsmTransition[] | GlobalTransitions [get, set] |
Global transitions defined by the FSM. | |
FsmVariables | Variables [get, set] |
Variables used by the FSM. | |
FsmState | ActiveState [get] |
Current active state. |
|
FsmState | PreviousActiveState [get] |
State that was active before the current active state. |
Unity Event Handling
Use these property flags to subscribe to Unity Events:
- MouseEvents
- HandleCollisionEnter
- HandleCollisionStay
- HandleCollisionExit
- HandleTriggerEnter
- HandleTriggerStay
- HandleTriggerExit
- HandleOnGUI
- HandleFixedUpdate
- HandleApplicationEvents
Setting a flag to true will add a runtime component that forwards the corresponding Unity events to the FSM.
For an example, look at PlayMaker/Actions/CollisionEvent.cs.