2022-04-07 19:22:29 +02:00
|
|
|
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;
|
2022-06-06 16:21:26 +02:00
|
|
|
public float baseAttack;
|
2022-04-07 19:22:29 +02:00
|
|
|
|
2022-05-18 13:58:41 +02:00
|
|
|
private void Awake()
|
2022-04-07 19:22:29 +02:00
|
|
|
{
|
2022-05-18 13:58:41 +02:00
|
|
|
health = maxHealth.initialValue;
|
2022-04-07 19:22:29 +02:00
|
|
|
}
|
|
|
|
|
2022-06-11 17:49:19 +02:00
|
|
|
public void TakeDamage(float damage)
|
2022-04-07 19:22:29 +02:00
|
|
|
{
|
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
|
|
|
|
2022-04-07 19:22:29 +02:00
|
|
|
}
|