Пример #1
0
        /// <summary>
        /// Handles trigger exit effects.
        /// </summary>
        /// <param name="collision"></param>
        private void OnTriggerExit2D(Collider2D collision)
        {
            AreaEffect areaEffect = collision.gameObject.GetComponent <AreaEffect>();

            if (areaEffect != null)
            {
                areaEffect.RemoveEffect(this);
            }
        }
Пример #2
0
        /// <summary>
        /// Handles trigger enter effects .
        /// </summary>
        /// <param name="collision"></param>
        private void OnTriggerEnter2D(Collider2D collision)
        {
            PlayerCollisionEffect effect = collision.gameObject.GetComponent <PlayerCollisionEffect>();

            if (effect != null)
            {
                effect.OnHit(this);
            }

            AreaEffect areaEffect = collision.gameObject.GetComponent <AreaEffect>();

            if (areaEffect != null)
            {
                areaEffect.AddEffect(this);
            }
        }