Beispiel #1
0
    //keep the paddle within boundaries
    void stayWithinBoundaries()
    {
        Vector3 lower = paddleScript.getLower();
        Vector3 upper = paddleScript.getUpper();

        if (getPos().y < lower.y)         //lower
        {
            this.transform.position = new Vector3(this.transform.position.x, lower.y, this.transform.position.z);
        }
        if (getPos().y > upper.y)         //upper
        {
            this.transform.position = new Vector3(this.transform.position.x, upper.y, this.transform.position.z);
        }
    }