Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5.  
  6.  
  7. public class Player_Health : MonoBehaviour
  8. {
  9.  
  10. public int health;
  11. public bool hasDied;
  12.  
  13. // Use this for initialization
  14. void Start()
  15. {
  16. hasDied = false;
  17. }
  18.  
  19. // Update is called once per frame
  20. void Update()
  21. {
  22. if (gameObject.transform.position.y < -7)
  23. {
  24. {
  25. hasDied = true;
  26. }
  27. if (hasDied == true)
  28. {
  29. StartCoroutine("Die");
  30. }
  31. }
  32. IEnumerator Die()
  33. {
  34. SceneManager.LoadScene("Main");
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement