Scriptum/Assets/Scripts/Enemies' Scprits/Enemy.cs
2022-05-26 13:30:59 +02:00

27 lines
512 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
public float moveSpeed;
public string enemyName;
public FloatValue maxHealth;
public float health;
private void Awake()
{
health = maxHealth.initialValue;
}
private void TakeDamage(float damage)
{
health -= damage;
if (health <= 0)
{
this.gameObject.SetActive(false);
}
}
}