Healthbar

This commit is contained in:
RochesterX
2025-03-03 18:55:03 -05:00
parent 1e6e33079f
commit 0f0c674d5c
8 changed files with 328 additions and 33 deletions

View File

@@ -86,6 +86,21 @@ public class Damageable : MonoBehaviour
{
gameManager.PlayerDied(gameObject); //add death animation trigger
}
}
public void Respawn()
{
transform.position = GameManager.Instance.spawnPosition;
if (TryGetComponent<Rigidbody2D>(out var rb))
{
rb.linearVelocity = Vector2.zero;
}
if (TryGetComponent<Damageable>(out var damageable))
{
damageable.ResetDamage();
}
}
public void ResetDamage()