Implemented end of game screen

This commit is contained in:
Max 2025-03-04 17:02:03 +01:00
parent ac10c8a2fc
commit 3651adbef8
23 changed files with 20035 additions and 19365 deletions

View file

@ -8,6 +8,7 @@ public class Player : MonoBehaviour
public event Action<int> DiamondCountUpdated;
public event Action<int> HealthUpdated;
public event Action<int> DamageTaken;
public event Action Died;
[SerializeField] private int maxHealth;
[SerializeField] private int diamonds;
@ -32,6 +33,16 @@ public class Player : MonoBehaviour
UpdateGUI();
}
public int GetDiamondCount()
{
return diamonds;
}
public int GetHealthScore()
{
return _healthBar[_healthIndex];
}
public void AddDiamonds(int count)
{
diamonds += count;
@ -44,6 +55,14 @@ public class Player : MonoBehaviour
{
_healthIndex += damage;
UpdateGUI();
if (_healthIndex == _healthBar.Length - 1)
{
Died?.Invoke();
}
}
else
{
Died?.Invoke();
}
DamageTaken?.Invoke(damage);
}