void GameOver() //created a new GameOverMenu, placed gameobject on InGameMenuScriptHolder. Please put Final Score and make button be selected with GamePad { players = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject g in players) { g.gameObject.SetActive(false); } if (WinOrLose) { WinOrLoseText.GetComponent <TextMeshProUGUI>().text = "YOU WON!"; } else { WinOrLoseText.GetComponent <TextMeshProUGUI>().text = "YOU LOSE!"; } if (Input.GetAxis("AlljoyH") > 0.1f) { PauseESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(quitButton); } else if (Input.GetAxis("AlljoyH") < -0.1f) { PauseESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(restartButton); } else { PauseESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(resumeButton); //be replaced with the nextLevelButton } }
void GameIsPaused() { if (Input.GetAxis("AlljoyH") > 0.1f) { PauseESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(quitButton); if (Input.GetKeyDown(KeyCode.JoystickButton0)) { BackToMainMenu(); } } else if (Input.GetAxis("AlljoyH") < -0.1f) { PauseESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(restartButton); if (Input.GetKeyDown(KeyCode.JoystickButton0)) { RetryGame(); } } else { PauseESystem.GetComponent <UnityEngine.EventSystems.EventSystem>().SetSelectedGameObject(resumeButton); if (Input.GetKeyDown(KeyCode.JoystickButton0)) { ResumeGame(); } } }