public void TakeDamage(float damageAmount) { if (playerHealth - damageAmount <= 0) { playerHealth = 0; PlayerDeath(); } else { playerHealth -= damageAmount; } playerUI.CmdUpdatePlayerHP(playerHealth, MaxHealth); }