Ejemplo n.º 1
0
        /// <summary>
        /// Handles collision enter effects .
        /// </summary>
        /// <param name="collision"></param>
        private void OnCollisionEnter2D(Collision2D collision)
        {
            PlayerCollisionEffect effect = collision.gameObject.GetComponent <PlayerCollisionEffect>();

            if (effect != null)
            {
                effect.OnHit(this);
            }
        }
Ejemplo n.º 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);
            }
        }