58 lines
901 B
C#
58 lines
901 B
C#
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()
|
|
{
|
|
|
|
}
|
|
|
|
}
|