Пример #1
0
    // this one resets the cueball's position after it was potted or something
    public void SpotBallOnTableAndHouseKeeping(Vector3 position, Vector3 velocity, Vector3 angular)
    {
        // determine if the position is valid, if not keep on trying to get the closest position possible
        GetComponent <Rigidbody>().position = cueController.givemeagoodposition(position);

        GetComponent <Rigidbody>().isKinematic = false;
        GetComponent <Rigidbody>().useGravity  = true;
        GetComponent <Collider>().enabled      = true;

        GetComponent <Rigidbody>().velocity        = velocity;
        GetComponent <Rigidbody>().angularVelocity = angular;

        if (pocketid != -1)
        {
            PocketController pc = PocketController.FindeHoleById(pocketid);

            pc.IncreaseSplineLength();

            pocketid = -1;
        }

        GameManager_script.DecrementBallPocketed(cueController.TrackingShotAsPlayerOne, cueController.TrackingShotAsPlayerTwo);

        cueController.pocketedBallControllers.Remove(this);
        cueController.pocketedBallControllers.TrimExcess();
    }