void makeThrow(ThrowDistance throwDistance, ThrowCurve throwCurve, ThrowType throwType)
 {
     //Debug.Log("Throwing at distance " + throwDistance + ", curve " + throwCurve + ", and type " + throwType);
     heldDiscTransform.localPosition = initialDiscPosition; // Reset the held disc position
     playerState = PlayerState.FREE;
     discController.CmdMakeThrow(throwDistance, throwCurve, throwType);
     playerNetworkController.ReleaseDiscAuthority(); // Hand auth over disc back to server
     cameraController.toggleFirstPersonCamera();
 }
    public void CmdMakeThrow(ThrowDistance throwDistance, ThrowCurve throwCurve, ThrowType throwType)
    {
        // Get indices for arrays from type of throw
        curveIndex = (int)throwCurve;
        int durationIndex = (int)throwDistance, heightIndex = (int)throwDistance, distanceIndex = (int)throwDistance;

        // Add forces
        useDiscBody(true);
        discBody.AddForce(transform.forward * distanceValues[distanceIndex]);
        discBody.AddForce(Vector3.up * heightValues[heightIndex]);

        // Spin the disc and make it fly
        discState = DiscState.FLIGHT;
        discBody.AddTorque(transform.up * rotationTorque);

        // Start routine for moving sideways
        curveEndTime   = Time.time + durationValues[durationIndex];
        curveDirection = transform.right;
        StartCoroutine("CurveRoutine");

        // Start routine for detecting collisions
        StartCoroutine("CollisionsOnRoutine");
    }
    void checkDiscActions()
    {
        // Vertical and horizontal input
        v = Input.GetAxis("Vertical");
        h = Input.GetAxis("Horizontal");

        // Enable rotating
        transform.Rotate(0, h * pivotTurnSpeed * Time.deltaTime, 0);

        // Do pivoting
        Vector3 newPosition = heldDiscTransform.localPosition;

        newPosition.x += pivotSpeed * Input.GetAxis("Mouse X");
        if (Mathf.Abs(newPosition.x - initialDiscPosition.x) > pivotHorizontalReach)
        {
            newPosition.x = heldDiscTransform.localPosition.x;
        }
        newPosition.y += pivotSpeed * Input.GetAxis("Mouse Y");
        if (Mathf.Abs(newPosition.y - initialDiscPosition.y) > pivotVerticalReach)
        {
            newPosition.y = heldDiscTransform.localPosition.y;
        }
        heldDiscTransform.localPosition = newPosition;

        // Throw parameters
        ThrowDistance throwDistance = ThrowDistance.MEDIUM;
        ThrowCurve    throwCurve    = ThrowCurve.STRAIGHT;

        // Check input for throw distance
        if (Input.GetKey(KeyCode.Alpha1))
        {
            throwDistance = ThrowDistance.POP;
        }
        if (Input.GetKey(KeyCode.Alpha2))
        {
            throwDistance = ThrowDistance.SHORT;
        }
        if (Input.GetKey(KeyCode.Alpha3))
        {
            throwDistance = ThrowDistance.MEDIUM;
        }
        if (Input.GetKey(KeyCode.Alpha4))
        {
            throwDistance = ThrowDistance.FAR;
        }
        if (Input.GetKey(KeyCode.Alpha5))
        {
            throwDistance = ThrowDistance.HUCK;
        }

        // Check input for throw curve
        if (Input.GetKey("z"))
        {
            throwCurve = ThrowCurve.LEFT;
        }
        if (Input.GetKey("x"))
        {
            throwCurve = ThrowCurve.STRAIGHT;
        }
        if (Input.GetKey("c"))
        {
            throwCurve = ThrowCurve.RIGHT;
        }

        // Check normal vs hammer throw
        if (interactInput() && interactReady())
        {
            makeThrow(throwDistance, throwCurve, ThrowType.NORMAL);
        }
        else if (Input.GetMouseButtonDown(1))
        {
            makeThrow((ThrowDistance)Random.Range(0, 4), (ThrowCurve)Random.Range(0, 2), ThrowType.NORMAL);
        }
    }