28 lines
541 B
C#
28 lines
541 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;
|
|
public float baseAttack;
|
|
|
|
private void Awake()
|
|
{
|
|
health = maxHealth.initialValue;
|
|
}
|
|
|
|
public void TakeDamage(float damage)
|
|
{
|
|
health -= damage;
|
|
if (health <= 0)
|
|
{
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
}
|