Advertisement
Guest User

Untitled

a guest
Feb 10th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class GameManager : MonoBehaviour {
  7.  
  8. bool gameHasEnded = false;
  9. public GameObject completeLevelUI;
  10.  
  11. public void CompleteLevel ()
  12. {
  13. completeLevelUI.SetActive (true);
  14. }
  15.  
  16.  
  17. public void EndGame() {
  18.  
  19. if (gameHasEnded == false) {
  20.  
  21. gameHasEnded = true;
  22. Invoke("Restart", 1.5f);
  23.  
  24. }
  25. }
  26.  
  27. void Restart ()
  28. {
  29. SceneManager.LoadScene (SceneManager.GetActiveScene ().name);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement