// Helper method that handles all of the necessary logic when the player gets hurt public void PlayerHurt(float attackPower) { if (isTakingDamage == false && playerHealth.isInvincible == false) { // We first stop specific states if they are valid if (isDucking == true) { playerCollider.size = new Vector2(1, origPlayerHeight); playerCollider.offset = new Vector2(0, 0); isDucking = false; } if (isInhaling == true) { inhaleHitboxChild.SetActive(false); isInhaling = false; } // The player then takes damage and are briefly invincible playerHealth.TakeDamage(attackPower); playerHealth.ActivateInvincibility(); isTakingDamage = true; playerGraphics.ChangeSprite("isDamaged"); Invoke("StopDamageLook", resetDamageLookTimer); } }