Files
GameDevTVTutFPS/Assets/Scripts/Enemies/EnemyHealth.cs
2026-01-13 15:43:33 +00:00

31 lines
588 B
C#

using UnityEngine;
public class EnemyHealth : MonoBehaviour
{
[SerializeField] int maxHealth = 100;
int currentHealth;
void Awake()
{
currentHealth = maxHealth;
}
public void TakeDamage(int damage)
{
currentHealth -= damage;
if (currentHealth <= 0)
{
gameObject.SetActive(false);
}
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}