HUD Arbeiten begonnen, ChangeHealthScript neu erstellt, neue und alte Methoden eingebaut

This commit is contained in:
2026-02-09 11:37:52 +01:00
parent f10a0ec485
commit 42b50afc95
5 changed files with 1083 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,57 @@
using TMPro;
using UnityEngine;
using static UnityEngine.EventSystems.EventTrigger;
public class ChangeHealth : MonoBehaviour
{
[SerializeField] GameObject panel;
[SerializeField] GameObject gameOverSceen;
[Header("UI and HUD")]
[SerializeField] TMP_Text energyHUD;
[SerializeField] TMP_Text healthHUD;
InventoryScript inventory;
private void Awake()
{
inventory = panel.GetComponent<InventoryScript>();
}
void Start()
{
energyHUD.text = inventory.Energy.ToString();
healthHUD.text = inventory.Health.ToString();
gameOverSceen.SetActive(false);
}
void Update()
{
if (inventory.Health <= 0)
{
Die();
}
}
public void GetHit()
{
}
public void Die()
{
gameOverSceen.SetActive(true);
}
public void NewChance()
{
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8336b8f8234487443af56cbe19330e6e

View File

@@ -1,7 +1,11 @@
using TMPro;
using UnityEngine; using UnityEngine;
public class InventoryScript : MonoBehaviour public class InventoryScript : MonoBehaviour
{ {
[Header("Variables")]
//Energy //Energy
[SerializeField] int energy = 10; [SerializeField] int energy = 10;
@@ -23,6 +27,7 @@ public class InventoryScript : MonoBehaviour
public int Health { get => health; set => health = value; } public int Health { get => health; set => health = value; }
public int Gems { get => gems; set => gems = value; } public int Gems { get => gems; set => gems = value; }
void Start() void Start()
{ {