private void GameManager_OnApplicationStateChange(ApplicationStateChangeArgs applicationStateArgs)
 {
     if (applicationStateArgs.Current == EApplicationState.Ingame)
     {
         GameManager.PlayerController.OnPlayerChunkUpdate += _debugPlayerDetails.DrawLines;
         _debugPlayerDetails.Initialise(GameManager.PlayerController);
         _debugWorldDetails.Initialise(GameManager.WorldController, GameManager.PlayerController);
         _debugPlayerDetails.DrawLines(GameManager.PlayerController.transform.position);
     }
     Debug.Log("[DebugController] - GameManager_OnApplicationStateChange(object, ApplicationStateArgs) \n "
               + $"applicationStateArgs.Current: {applicationStateArgs.Current.ToString()}");
 }
Example #2
0
 /// <summary>
 /// Displays and hides canvas elements for the main menu when the application state changes
 ///
 /// Any state -> Menu = Display the main menu canvas
 /// </summary>
 /// <param name="applicationStateArgs"></param>
 private void GameManager_OnApplicationStateChange(ApplicationStateChangeArgs applicationStateArgs)
 {
     // Transition to menu state, this could be due to just launching the application or due to just closing the game
     if (applicationStateArgs.Current == EApplicationState.Menu)
     {
         gameObject.SetActive(true);
         if (applicationStateArgs.Previous == EApplicationState.ReturningToMenu)
         {
             _backButton.gameObject.SetActive(false);
             _activePanel.SetActive(false);
             _activePanel = _mainPanel;
             _mainPanel.SetActive(true);
         }
     }
     // Transition from menu state, this could be due to closing the application or due to loading a game
     else if (applicationStateArgs.Previous == EApplicationState.Menu)
     {
         gameObject.SetActive(false);
     }
 }
Example #3
0
        private void GameManager_OnApplicationStateChange(ApplicationStateChangeArgs applicationStateChange)
        {
            switch (applicationStateChange.Current)
            {
            case (EApplicationState.Connecting):
            {
                Initialise();
                break;
            }

            case (EApplicationState.ReturningToMenu):
            {
                ActiveEntities.Clear();
                InstanceMappedToId.Clear();
                EntitiesToUnload.Clear();
                EntityIdCounter = 0;
                break;
            }

            default:
                break;
            }
        }