Implemented end of game screen
This commit is contained in:
parent
ac10c8a2fc
commit
3651adbef8
23 changed files with 20035 additions and 19365 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue