mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-11-11 04:22:40 +00:00
nya
This commit is contained in:
1 parent
61a7f5984b
commit
b760b5d65c
15 files changed
+2390
-44
No files matched your search
@@ -11,6 +11,8 @@ public class Health : MonoBehaviour {
|
||||
public bool isDead;
|
||||
public UnityEvent OnDead = new UnityEvent();
|
||||
public UnityEvent OnHit = new UnityEvent();
|
||||
public GameObject three,two,one,zero;
|
||||
public AudioManager audioManager;
|
||||
|
||||
void Start() {
|
||||
currentHealth = startingHealth;
|
||||
@@ -27,6 +29,22 @@ public class Health : MonoBehaviour {
|
||||
currentHealth = Mathf.Clamp(currentHealth - 1, 0, startingHealth);
|
||||
isDead = currentHealth <= 0;
|
||||
OnHit.Invoke();
|
||||
if (currentHealth == 2)
|
||||
{
|
||||
three.SetActive(false);
|
||||
two.SetActive(true);
|
||||
}
|
||||
if (currentHealth == 1)
|
||||
{
|
||||
two.SetActive(false);
|
||||
one.SetActive(true);
|
||||
}
|
||||
if (currentHealth == 0)
|
||||
{
|
||||
one.SetActive(false);
|
||||
zero.SetActive(true);
|
||||
}
|
||||
audioManager.Play("pencilbreak");
|
||||
if (isDead) OnDead.Invoke();
|
||||
StartCoroutine(damageTimer());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user