Exemplo n.º 1
0
        private void OnCollisionEnter(Collision collision)
        {
            IDying idying = collision.transform.gameObject.GetComponent <IDying>();

            if (idying != null)
            {
                if (GetComponent <Rigidbody>().velocity.y < -2)
                {
                    idying.TakeDamage(damage);
                }
            }
        }
Exemplo n.º 2
0
        private void OnTriggerEnter(Collider other)
        {
            IDying idying = other.GetComponent <IDying>();

            if (idying != null)
            {
                idying.TakeDamage(damage);
            }
            if (isStatic)
            {
                return;
            }

            gameObject.SetActive(false);
        }