Script reorganization and UseItem created

This commit is contained in:
djkellerman
2025-02-28 13:49:02 -05:00
parent b21efcd1eb
commit f1d9006c94
11 changed files with 138 additions and 137 deletions

View File

@@ -10,8 +10,12 @@ public class Damageable : MonoBehaviour
public float maxDamage = 1000f;
public HealthBar healthBar;
private GameManager gameManager;
private void Start()
{
gameManager = GameManager.Instance;
if (healthBar != null)
{
healthBar.SetMaxHealth(maxDamage);
@@ -78,10 +82,9 @@ public class Damageable : MonoBehaviour
private void Die()
{
PlayerLives playerLives = GetComponent<PlayerLives>(); //add death animation trigger
if (playerLives != null)
if (gameManager != null)
{
playerLives.PlayerDied();
gameManager.PlayerDied(gameObject); //add death animation trigger
}
}