Пример #1
0
        private void OnTriggerStay(Collider other)
        {
            var otherHealth = other.gameObject.GetComponent <Health>();

            if (otherHealth != null)
            {
                _damageOnContact.Damage(damageInflicted, otherHealth);
            }
        }
Пример #2
0
        private void OnTriggerEnter(Collider other)
        {
            var otherHealth = other.gameObject.GetComponent <Health>();

            if (otherHealth != null)
            {
                _damageOnContact.Damage(DamageInflicted, otherHealth);
            }
            gameObject.SetActive(false);
        }
Пример #3
0
        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);
        }