Esempio n. 1
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "Player")
        {
            PaddleController paddle         = other.gameObject.GetComponent <PaddleController> ();
            float            paddleVertical = paddle.GetVertical();
            rb.AddForce(Vector2.up * paddleVertical * angleForce);
            if (other.relativeVelocity.x < 0f)
            {
                rb.AddForce(Vector2.right * escalationForce);
            }
            else
            {
                rb.AddForce(Vector2.right * -escalationForce);
            }
//			rb.AddForce (Vector2.right * paddleVertical * angleForce);
        }
    }