diff --git a/Assets/Scripts/FallCheck.cs b/Assets/Scripts/FallCheck.cs index 16cb63e..4de2a92 100644 --- a/Assets/Scripts/FallCheck.cs +++ b/Assets/Scripts/FallCheck.cs @@ -1,15 +1,24 @@ using UnityEngine; using System.Collections; +using UnityEngine.UI; public class FallCheck : MonoBehaviour { public GameObject player; public GameObject cam; + public Text health; // Update is called once per frame void FixedUpdate () { if (player.transform.position.y < cam.transform.position.y - cam.transform.localScale.y) + { player.transform.position = new Vector3(0, 0, 0); + health.text = "Health: " + player.GetComponent().removeHP(1); + if (player.GetComponent().getHP() == 0) + { + player.GetComponent().Death(); + } + } } }