24 lines
490 B
C#
24 lines
490 B
C#
using UnityEngine;
|
|
|
|
public class EnemyHealthController : MonoBehaviour
|
|
{
|
|
[SerializeField] float totalHealth;
|
|
// 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()
|
|
{
|
|
|
|
}
|
|
public void TakeDamage(float damageToTake)
|
|
{
|
|
totalHealth -= damageToTake;
|
|
if(totalHealth <= 0)
|
|
Destroy(gameObject);
|
|
}
|
|
}
|