added enemy dead animation

This commit is contained in:
Mausham
2025-12-30 17:51:20 -08:00
parent 0ec69f66c9
commit b59d12631f
16 changed files with 41248 additions and 54 deletions

View File

@@ -7,19 +7,24 @@ namespace Darkmatter.Presentation
{
public float health = 100f;
public Animator enemyAnimator;
public bool isDead = false;
public void Die()
{
isDead = true;
Debug.Log("Dead");
this.gameObject.SetActive(false);
enemyAnimator.SetLayerWeight(0, 1);
enemyAnimator.SetTrigger("Death");
Destroy(this.gameObject, 5f);
}
public void TakeDamage(float damage)
{
{ if(isDead) return;
health -= damage;
enemyAnimator.SetLayerWeight(1, 1);
enemyAnimator.SetTrigger("Hit");
if (health <= 0) Die();
Debug.Log("Damage Taken");
enemyAnimator.SetLayerWeight(1, 1);
enemyAnimator.SetTrigger("Hit");
}
}
}