Files
ClearTheZone/Assets/Scripts/EnemyHealth.cs
T
2026-08-20 09:52:06 +02:00

27 lines
378 B
C#

using UnityEngine;
public class EnemyHealth : MonoBehaviour
{
public int maxHP = 100;
private int curHP;
void Start()
{
curHP = maxHP;
}
public void TakeDamage(int damageAmount)
{
curHP -= damageAmount;
if (curHP <= 0)
{
Die();
}
}
void Die()
{
Destroy(gameObject);
}
}