public virtual void TakeDamage(Damage damage) { if (Dead) { return; } Health -= damage.Ammount; OnDamageTake?.Invoke(); if (Health <= 0) { Health = 0; Die(); } //if (Animator != null) { // if (damage.Type == DamageType.Small) { // OnSmallDamageTake(); // } // else if (damage.Type == DamageType.Middle) { // OnMiddleDamageTake(); // } // else if (damage.Type == DamageType.Big) { // OnBigDamageTake(); // } //} }
public void TakeDamage(int damage) { if (currentHealth > 0) { OnDamageTake?.Invoke(damage); //send notification to game manager to update UI on controller currentHealth -= damage; healthSlider.value = currentHealth; gateAttackedSource.PlayOneShot(sm.gateAttacked, sm.volume[sm.gateAttacked]); } else if (currentHealth <= 0 && !isDestroyed) { Collapse(); } }