public void OnTriggerEnter(Collider collision) {//controle de colisção com os ataques da personagem if (collision.CompareTag("HitBoxCollider") && !IsHit && !IsDead) { IsHit = true; IsWalking = false; switch (gameObject.tag) { case "Enemy": //se for um inimigo comum EnemyTotalLife -= 1; Gamecontroller.EnemyHeartController((int)EnemyTotalLife); Gamecontroller.TimerEnemyBar = 3f; break; case "Boss": //se for um chefe o dano é menor EnemyTotalLife -= 0.5f; Gamecontroller.BossHeartController(EnemyTotalLife); break; } Gamecontroller.PlaySFX(Gamecontroller.SfxDamageTaken); if (EnemyTotalLife <= 0)//verifica se a vida zerou para a animação de morte { IsDead = true; if (gameObject.CompareTag("Boss")) { Gamecontroller.PlaySFX(Gamecontroller.SfxBossDead); } else { Gamecontroller.PlaySFX(Gamecontroller.SfxEnemyDead); } NpcAnimator.SetTrigger("IsDead"); } else//se a vida não zerou inicia a animação de ter tomado dano { NpcAnimator.SetTrigger("Hitted"); IsHit = false; } } }