If you die, you respawn

main
Matthew Kalahiki 4 years ago
parent 3bef4a7d1a
commit 56e99dac27

@ -2302,7 +2302,7 @@ MonoBehaviour:
artImage: {fileID: 430284682} artImage: {fileID: 430284682}
obtainedPowerups: obtainedPowerups:
powerupStatus: powerupStatus:
sceneToLoad: sceneToLoad: BossRoom
music: music:
- {fileID: 8300000, guid: f29919963390ff24fa1ae468277b309e, type: 3} - {fileID: 8300000, guid: f29919963390ff24fa1ae468277b309e, type: 3}
--- !u!4 &637676178 --- !u!4 &637676178

@ -4,7 +4,7 @@ using UnityEngine;
public class Health : MonoBehaviour public class Health : MonoBehaviour
{ {
public int currentHealth = 0; public int currentHealth;
public int maxHealth = 100; public int maxHealth = 100;
public HealthBarCustom healthBar; public HealthBarCustom healthBar;
@ -26,7 +26,12 @@ public class Health : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (currentHealth <= 0)
{
GameManager.Instance.LoadLevel("Spawn", new Vector3(0,0,0));
currentHealth = maxHealth;
healthBar.SetHealth(currentHealth);
}
} }
public void DamagePlayer(int damage) public void DamagePlayer(int damage)

Loading…
Cancel
Save