using Darkmatter.Core;
using UnityEngine;

namespace Darkmatter.Presentation
{
    public class Enemy : MonoBehaviour, IDamageable
    {
        public float health = 100f;
        public Animator enemyAnimator;
        public void Die()
        {
            Debug.Log("Dead");
            this.gameObject.SetActive(false);
        }

        public void TakeDamage(float damage)
        {
            health -= damage;
            enemyAnimator.SetLayerWeight(1, 1);
            enemyAnimator.SetTrigger("Hit");
            if (health <= 0) Die();
            Debug.Log("Damage Taken");
        }
    }
}
