mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-09-11 08:17:01 +00:00
Fucking i haven't slept all night and i got health and water spirits hell yeah
This commit is contained in:
20 files changed
+1540
-504
No files matched your search
+10
-1
@@ -3,16 +3,21 @@ using UnityEngine.Events;
|
||||
|
||||
// @MindfulMinun
|
||||
public class Health : MonoBehaviour {
|
||||
public int startingHealth;
|
||||
public int startingHealth = 3;
|
||||
public int currentHealth;
|
||||
public bool isInvincible;
|
||||
public bool isDead;
|
||||
public Animator healthBarAnimator;
|
||||
public UnityEvent OnDead;
|
||||
public UnityEvent OnHit;
|
||||
|
||||
void Start() {
|
||||
OnDead = new UnityEvent();
|
||||
OnHit = new UnityEvent();
|
||||
if (healthBarAnimator == null) {
|
||||
Debug.Log("HealthBarAnimator not found! Please attach the Health bar's animator to the Health script so the health bar can be animated.");
|
||||
}
|
||||
currentHealth = startingHealth;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
@@ -20,6 +25,10 @@ public class Health : MonoBehaviour {
|
||||
takeHit();
|
||||
OnHit.Invoke();
|
||||
}
|
||||
|
||||
if (healthBarAnimator != null) {
|
||||
healthBarAnimator.SetInteger("Health", currentHealth);
|
||||
}
|
||||
}
|
||||
|
||||
void takeHit() {
|
||||
|
||||
Reference in new issue
Block a user