private void ApplicationStateChange(EApplicationState newState) { EApplicationState previous = _currentApplicationState; _currentApplicationState = newState; OnApplicationStateChange?.Invoke(new ApplicationStateChangeArgs(previous, _currentApplicationState)); }
/// <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()); }
void Awake() { if (ApplicationController.Instance != null) { Debug.LogError("[ApplicationController] - instance already set!!"); } else { ApplicationController.Instance = this; } this.state = EApplicationState.Initializing; }
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; } }
void Start() { this.State = EApplicationState.Menu; }
public ApplicationStateChangeArgs(EApplicationState previous, EApplicationState current) { Previous = previous; Current = current; }