private IEnumerator GetHit(int dmg = 1) { RpgManager.PlaySFX(sfx_hit); pv -= dmg; RpgManager.HUD.UpdateHearts(pv, 3); animator.SetTrigger("Hit"); isHitInCooldown = true; if (pv <= 0) { GetComponent <Collider2D>().enabled = false; animator.SetBool("GameOver", true); enabled = false; Stop(); yield return(new WaitForSeconds(1.0f)); RpgManager.GameOver(); yield break; } yield return(new WaitForSeconds(hitDelay)); isHitInCooldown = false; }