using TMPro; using UnityEngine; using static UnityEngine.EventSystems.EventTrigger; public class ChangeHealth : MonoBehaviour { [Header("UI and HUD")] [SerializeField] GameObject panel; [SerializeField] TMP_Text healthHUD; [SerializeField] public int standardHealth = 3; [Header("ScriptPile")] InventoryScript inventory; GameOver end; private void Awake() { inventory = panel.GetComponent(); end = panel.GetComponent(); } void Start() { inventory.Health = standardHealth; Debug.Log(inventory.Health); } void Update() { healthHUD.text = inventory.Health.ToString(); if (inventory.Health <= 0) { Die(); } } public void GetHit() //MUSS NOCH MIT ENEMIES VERKNÜPFT WERDEN { if (inventory.Health > 0) { inventory.Health -= 1; //MAGIC NUMBER BITTE BEACHTEN } Debug.Log("Ouch, you bastard."); } public void Die() { //Time.timeScale = 0; //Wieder umlegen end.recentDeath = true; end.ShowDeathScreen(); Debug.Log("rest in pizza"); } }