public void DamagePlayer(float damageValue) { // only take damage when normal if (currentState == PlayerState.Normal) { playerHealth -= damageValue; //animator.SetFloat("health", playerHealth); uiController.UpdateHealth(playerHealth); if (playerHealth < maxHealth / 2.0f) { // set it to exactly half playerHealth = maxHealth / 2.0f; sfx.StartingToOverheat(); sfx.DisablePlayer(); currentState = PlayerState.Disabled; interruptRepairing = true; // stop horizontal movement rb.velocity = new Vector2(0f, rb.velocity.y); } } }