public virtual void TakeDamage(float damageAmount) { if (immune) { return; } else { if (gameObject.tag == "Player") { GameManager.gameManager.GameOver(); } else { onHurt.CallEvent(0); } } }
public virtual void TakeDamage(float damageAmount, DamageType damageType) { if (isImmune == true) { Debug.Log(gameObject.name + " is Immune, Such Wow"); return; } currentHealth -= damageResistance.CalculateDamageResistance(damageAmount, damageType); Debug.Log(gameObject.name + " Ouch, he hit me"); currentHealth = Mathf.Clamp(currentHealth, 0, maxHealth); if (currentHealth <= 0) { onDeath.CallEvent(0); } else { //Maybe Create A Stagger Function Here onHurt.CallEvent(currentHealth / maxHealth); } }