예제 #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        IBumper bumper = collision.AsBumper();

        if (bumper != null)
        {
            bumper.OnCenterBump(orb);
        }
    }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        IGoal goal = collision.gameObject.GetComponent <Goal>();

        if (goal != null)
        {
            if (currentBehavior != null)
            {
                currentBehavior.OnScore();
            }

            Game.Entities.GetEnemyPlayer(goal.Side).Score += 1;
            this.scoredSide = goal.Side;
            Game.FloatingText.CreateFloatingText("+1", TextStyles.Points, Game.Entities.GetEnemyHero(goal.Side).Position);
            Respawn();
        }

        IMinion minion = collision.gameObject.GetComponent <Minion>();

        if (minion != null)
        {
            if (currentBehavior != null)
            {
                if (minion.Owner.Side == currentBehavior.Owner.Side)
                {
                    currentBehavior.OnHitAllyMinion(minion);
                }
                else
                {
                    currentBehavior.HitEnemyMinion(minion);
                }
            }
        }

        IBumper bumper = collision.AsBumper();

        if (bumper != null)
        {
            timeOfLastBumperHit = Time.timeSinceLevelLoad;
            Vector2 collisionPoint = collision.bounds.ClosestPoint(this.Position);
            bumper.OnBump(this, collisionPoint);
        }
    }