namespace CleverCrow.Fluid.FSMs { public abstract class ActionBase : IAction { private bool _init; public virtual string Name { get; set; } = "Untitled"; public IState ParentState { get; set; } public void Update () { OnUpdate(); } /// /// Triggered every FSM tick when this state is active /// protected virtual void OnUpdate () {} public void Enter () { Init(); OnEnter(); } /// /// Triggered when entering the state /// protected virtual void OnEnter () {} /// /// Triggered when exiting the state /// public void Exit () { OnExit(); } public void Transition (string id) { ParentState.Transition(id); } protected virtual void OnExit () {} /// /// Triggered the first time this FSM runs Enter /// private void Init () { if (_init) return; OnInit(); _init = true; } protected virtual void OnInit () {} } }