protected void Init() { if (_instance != null) { Destroy(gameObject); return; } _instance = this; DontDestroyOnLoad(gameObject); _stateMachine = new StateMachine(); //Subscribe to OnGameStateChanged elsewhere if you want to see when a state changes as well as get access to information in the state _stateMachine.OnStateChanged += state => OnGameStateChanged?.Invoke(state); _stateMachine.OnStateChanged += state => StateChanged(state); }
public SecondState(StateControllerBase controllerBase) { controllerBase.StartCoroutine(YouCanAddCoroutines()); }