Files
MobileShooter/Assets/Darkmatter/Code/Presentation/Enemies/Enemy.cs
2025-12-30 16:22:49 -08:00

26 lines
607 B
C#

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");
}
}
}