Beispiel #1
0
 void inventoryButton()
 {
     if (Time.timeScale > 0.0f)    // This just checks if the game is paused
     {
         if (inventory.activeSelf) // if inventory is active when the button is pressed
         {
             Cursor.lockState = CursorLockMode.Locked;
             inventory.SetActive(false);      //deactivate it in game
             cam.isCamMovementAllowed = true; // allow camera movement
             if (playa != null)
             {
                 playa.menuEnabled(false);
             }
         }
         else //if inventory is not active when button is pressed
         {
             Cursor.lockState = CursorLockMode.None;
             inventory.SetActive(true);        //activate it in game
             cam.isCamMovementAllowed = false; //disallow camera movement
             EventSystem.current.SetSelectedGameObject(null);
             EventSystem.current.SetSelectedGameObject(firstSelectedSlot);
             if (playa != null)
             {
                 playa.menuEnabled(true);
             }
         }
     }
 }
 public void Resume()
 {
     Cursor.lockState = CursorLockMode.Locked;
     infoPanel.SetActive(false); // assert info panel inactive just in case
     PauseMenuUI.SetActive(false);
     Time.timeScale = 1f;
     IsGamePaused   = false;
     if (playa != null)
     {
         playa.menuEnabled(false);
     }
     if (music != null)
     {
         music.Play();
     }
 }