StateMachine
The StateMachine MonoBehaviour controls the state transitions.
State Discovery
On Awake, the StateMachine will search for IState components in its children and register them in the States
variable.
Switching states
During a state transition, the state component and/or state gameObject can be enabled/disabled if you check the Sync toggles in the StateMachine inspector. To switch states:
Machine.ChangeState<MyOtherStateType>();
await Machine.ChangeStateAsync<MyOtherStateType>();
Create your machine
using EODE.Wonderland;
using UnityEngine;
namespace MyProject {
[AddComponentMenu("My project/FSM 1/Machine")]
public class StateMachine : EODE.Wonderland.StateMachine {
// ... States common variables
// ... States common methods
}
}