using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace RichFrame.StateMachine { public abstract class StateManager<T> where T : IBaseState { public T currentState; public event Action<T> onCurrentStatusChanged; public virtual void Update() { if (currentState != null) { currentState.Update(); } } public virtual void MakeTransition(T state) { if (currentState != null) { currentState.QuitState(); } currentState = state; currentState.EnterState(); if (onCurrentStatusChanged != null) { onCurrentStatusChanged(currentState); } } } }