// --------------------------------------------------------------------------------------------
 private void OnDestroy()
 {
     if (_instance == this)
     {
         _instance = null;
     }
 }
Beispiel #2
0
        // --------------------------------------------------------------------------------------------
        private void InGame_Exit()
        {
            InGameController inGameController = gameObject.RequireComponent <InGameController>();

            inGameController.Completed -= InGameController_Completed;
            inGameController.enabled    = false;
        }
Beispiel #3
0
        // --------------------------------------------------------------------------------------------
        private void InGame_Enter()
        {
            InGameController inGameController = gameObject.RequireComponent <InGameController>();

            inGameController.Completed += InGameController_Completed;
            inGameController.enabled    = true;
        }
        // --------------------------------------------------------------------------------------------
        private void Awake()
        {
            if (_instance != null)
            {
                Debug.LogError("Only one instance of InGameController can exist at at a time");
                Destroy(this);
            }

            _instance = this;

            _stateMachine = new TofuStateMachine();
            _stateMachine.Register(State.Loading, Loading_Enter, Loading_Update, null);
            _stateMachine.Register(State.InGame, InGame_Enter, InGame_Update, null);
            _stateMachine.Register(State.PostGame, PostGame_Enter, null, null);
        }