public void TakeDamage(float damage, NormalAgentGame NAG) { //Debug.Log(this + " Take " + damage + " damage from: " + NAG); //AddReward(-0.2f); regenTimer = 0f; // reset the timer if (isCheating) { damage = 0f; } currentHealth -= damage; if (currentHealth <= 0) { RegisterDeath(); NAG.RegisterKill(); } }
public void TakeDamage(float amout, NormalAgentGame NAG) { isDamaged = true; // set the damaged flag to true regenTimer = 0f; // reset the timer to regenerate health currentHealth -= amout; playerAudio.Play(); // play the hurt sound efx SetHealthUI(); if (currentHealth <= 0 && !isDead) { NAG.RegisterKill(); Death(); } }