karen_constantine

Untitled

Apr 9th, 2023
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.SceneManagement;
  3.  
  4. public class GameController : MonoBehaviour
  5. {
  6. public static GameController instance;
  7.  
  8. public GameObject gameOverText;
  9. public bool gameOver = false;
  10. public float scrollSpeed = -1.5f;
  11.  
  12. void Awake()
  13. {
  14. if (instance == null)
  15. {
  16. instance = this;
  17. }
  18. else if (instance != this)
  19. {
  20. Destroy(gameObject);
  21. }
  22. }
  23.  
  24. void Update()
  25. {
  26. if (gameOver && Input.GetMouseButtonDown(0))
  27. {
  28. SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
  29. }
  30. }
  31.  
  32. public void BirdDied()
  33. {
  34. gameOverText.SetActive(true);
  35. gameOver = true;
  36. }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment