Scriptum/Assets/Scripts/Enemies' Scprits/Enemy.cs

28 lines
541 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
public float moveSpeed;
public string enemyName;
2022-05-18 13:58:41 +02:00
public FloatValue maxHealth;
public float health;
public float baseAttack;
2022-05-18 13:58:41 +02:00
private void Awake()
{
2022-05-18 13:58:41 +02:00
health = maxHealth.initialValue;
}
2022-06-11 17:49:19 +02:00
public void TakeDamage(float damage)
{
2022-05-18 13:58:41 +02:00
health -= damage;
2022-05-26 13:30:59 +02:00
if (health <= 0)
2022-05-18 13:58:41 +02:00
{
this.gameObject.SetActive(false);
}
2022-05-26 13:30:59 +02:00
}
2022-05-18 13:58:41 +02:00
}