Ejemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Redirect"))
        {
            // Getting rid of Redirect object
            StartCoroutine(StartHidingAnimationForRedirect(collision.gameObject, 0f));
            Destroy(collision.gameObject, 2f); // Destroy Redirect ball

            // Rotating ball velocity up
            Vector2 ballVelocity        = myRigidBody2D.velocity;
            Vector2 rotatedBallVelocity = Redirect.RotateVector2Up(ballVelocity, 70f);
            myRigidBody2D.velocity = rotatedBallVelocity;
        }
    }