private void OnTriggerStay(Collider other) { var otherHealth = other.gameObject.GetComponent <Health>(); if (otherHealth != null) { _damageOnContact.Damage(damageInflicted, otherHealth); } }
private void OnTriggerEnter(Collider other) { var otherHealth = other.gameObject.GetComponent <Health>(); if (otherHealth != null) { _damageOnContact.Damage(DamageInflicted, otherHealth); } gameObject.SetActive(false); }
private void OnCollisionEnter(Collision other) { Health otherHealth = other.gameObject.GetComponent <Health>(); if (otherHealth != null) { _damageOnContact.Damage(DamageInflicted, otherHealth); // Debug.Log($"{otherHealth.gameObject}'s health: {otherHealth.HealthValue}/{otherHealth.MaxHealthValue}"); } gameObject.SetActive(false); }