37 lines
636 B
C#
37 lines
636 B
C#
using Sirenix.OdinInspector;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class EnemyComponent : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
[Required]
|
|
[OnValueChanged("Setup")]
|
|
private Enemy enemy;
|
|
|
|
[ReadOnly]
|
|
[SerializeField]
|
|
private bool isDead;
|
|
|
|
[SerializeField]
|
|
private UnityEvent<int> updateInitialHealth;
|
|
|
|
private void Start()
|
|
{
|
|
Setup();
|
|
}
|
|
|
|
private void Setup()
|
|
{
|
|
updateInitialHealth.Invoke(enemy.health);
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
Destroy(gameObject, 3);
|
|
}
|
|
}
|