Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (BallIsPutting)
        {
            StartCoroutine(StopThePuttedBall());
        }

        if (BallShotIsOver == true)
        {
            if (GetComponent <Rigidbody>().IsSleeping())
            {
                GetComponent <Rigidbody>().drag        = 0;
                GetComponent <Rigidbody>().angularDrag = 0;
                //MAYBE BEFORE THIS WE CAN FIND A RANDOM UMBER TO PLACE IN THE BALL?
                transform.rotation = Quaternion.Euler(0, 90, 0);
                playerManagerScript.GolfBallHasStruckTerrain(false);
                playerManagerScript.changeHitGolfBall(false); // this method returns the camera back to the player after the ball stops moving,maybe
                BallShotIsOver = false;
                float dist = Vector3.Distance(transform.position, actualPlayer.transform.position);
                print("Distance of this Shot is " + dist);
            }
        }
    }