Exemplo n.º 1
0
        private void OnTriggerStay(Collider other)
        {
            var otherHealth = other.gameObject.GetComponent <Health>();

            if (otherHealth != null)
            {
                _damageOnContact.Damage(damageInflicted, otherHealth);
            }
        }
Exemplo n.º 2
0
        private void OnTriggerEnter(Collider other)
        {
            var otherHealth = other.gameObject.GetComponent <Health>();

            if (otherHealth != null)
            {
                _damageOnContact.Damage(DamageInflicted, otherHealth);
            }
            gameObject.SetActive(false);
        }
Exemplo n.º 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);
        }