Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6. public class Respawn : MonoBehaviour
  7. {
  8. public float timeLeft = 30.0f;
  9.  
  10. void Update()
  11. {
  12. timeLeft -= Time.deltaTime;
  13. if (timeLeft < 0)
  14. {
  15. GameOver();
  16. }
  17. }
  18.  
  19. private void GameOver()
  20. {
  21. SceneManager.LoadScene("GameOver");
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement