/// <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); } }
/// <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); } }