コード例 #1
0
        private void ApplicationStateChange(EApplicationState newState)
        {
            EApplicationState previous = _currentApplicationState;

            _currentApplicationState = newState;

            OnApplicationStateChange?.Invoke(new ApplicationStateChangeArgs(previous, _currentApplicationState));
        }
コード例 #2
0
        /// <summary>
        /// Initialises the application, game state and assets.
        /// Also starts listening for startup messages from the world and player.
        /// </summary>
        private void Awake()
        {
            _currentApplicationState = EApplicationState.Launching;
            _currentGameState        = EGameState.NotLoaded;

            // GameManager needs to listen for responses from both the world controller and local player controller
            WorldController.OnWorldControllerStartup   += WorldController_OnWorldControllerStartup;
            PlayerController.OnPlayerControllerStartup += PlayerController_OnLocalPlayerControllerStartup;

            StartCoroutine(InitialiseAssets());
        }
コード例 #3
0
        void Awake()
        {
            if (ApplicationController.Instance != null)
            {
                Debug.LogError("[ApplicationController] - instance already set!!");
            }
            else
            {
                ApplicationController.Instance = this;
            }

            this.state = EApplicationState.Initializing;
        }
コード例 #4
0
        private void ReactToStateSwitch(EApplicationState newState)
        {
            switch (newState)
            {
            case EApplicationState.Menu:
                SceneManager.LoadScene("Menu");
                break;

            case EApplicationState.Game:
                SceneManager.LoadScene("Game");
                break;

            case EApplicationState.Shutdown:
                Application.Quit();
                break;

            default:
                Debug.LogWarning("[ApplicationController] urecognized state : " + newState);
                break;
            }
        }
コード例 #5
0
 void Start()
 {
     this.State = EApplicationState.Menu;
 }
コード例 #6
0
 public ApplicationStateChangeArgs(EApplicationState previous, EApplicationState current)
 {
     Previous = previous;
     Current  = current;
 }