PausePanel
How do I use Pause Panel
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
57 | pausePanel.SetActive (true); | 1 |
64 | pausePanel.SetActive (false); | 2 |
36 | PausePanel (); | 3 |
234 | pausePanel.SetActive (false); | 4 |
244 | void PausePanel(){ | 5 |
271 | pausePanel.SetActive (true); | 6 |
278 | pausePanel.SetActive (false); | 7 |
57 | pausePanel.SetActive(true); | 8 |
63 | pausePanel.SetActive(false); | 9 |
31 | pausePanel.SetActive (true); | 10 |
File name: GameManagerScript.cs
Copy
56 public void pauseGame () {
57 pausePanel.SetActive (true);
58 bestScore.text = "Best Score: " + PlayerPrefs.GetInt ("bestScore");
59 highCoinScore.text = "Best Coin Score: " +PlayerPrefs.GetInt ("bestCoinScore");
60 Time.timeScale = 0f;
61 }
File name: GameManagerScript.cs
Copy
63 public void resumeGame () {
64 pausePanel.SetActive (false);
65 scoreText.text = "Score: " + PlayerMoveScript.instance.scoreCount;
66 Time.timeScale = 1f;
67 }
File name: GameplayController.cs
Copy
34 void Update () {
35 if(Input.GetKeyDown(KeyCode.Escape)){
36 PausePanel ();
37 }
38 }
File name: GameplayController.cs
Copy
233 public void ResumeButton(){
234 pausePanel.SetActive (false);
235 Time.timeScale = 1;
236 gameInProgress = true;
237 }
File name: GameplayController.cs
Copy
244 void PausePanel(){
245 if (gameInProgress && !pausePanel.activeInHierarchy) {
246 pausePanel.SetActive (true);
247 Time.timeScale = 0;
248 gameInProgress = false;
249 } else if(!gameInProgress && !pausePanel.activeInHierarchy) {
250 SceneManager.LoadScene ("Main Menu");
251 }
252 }
File name: GameplayController.cs
Copy
267 public void PauseGame(){
268 if (gameInProgress) {
269 gameInProgress = false;
270 Time.timeScale = 0;
271 pausePanel.SetActive (true);
272 }
273 }
File name: GameplayController.cs
Copy
275 public void ResumeGame(){
276 Time.timeScale = 1;
277 gameInProgress = true;
278 pausePanel.SetActive (false);
279 }
File name: GameManager.cs
Copy
55 public void PauseGame() {
56 Time.timeScale = 0f;
57 pausePanel.SetActive(true);
58 bestScoreText.text = "Best Score : " + Score.instance.GetHighScore();
59 }
File name: GameManager.cs
Copy
61 public void ResumeGame() {
62 Time.timeScale = 1f;
63 pausePanel.SetActive(false);
64 }
File name: GameManagerScript.cs
Copy
29 void Start () {
30 Time.timeScale = 0f;
31 pausePanel.SetActive (true);
32 instructionPanel.SetActive (true);
33 instructionText.gameObject.SetActive (true);
34 startGameText.gameObject.SetActive (true);
35 bestScore.text = "" + Scores.instance.GetHighScore ();
36 }
PausePanel 137 lượt xem
Gõ tìm kiếm nhanh...