This commit is contained in:
2026-08-20 11:35:03 +02:00
parent 2604185ce4
commit 1db2ec9a94
7 changed files with 185 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
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);
}
}