Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public SecondState(StateControllerBase controllerBase)
 {
     controllerBase.StartCoroutine(YouCanAddCoroutines());
 }