// Update is called once per frame
    void Update()
    {
        arm = Input.GetAxis("Arm");

        if (xInput.IsWorking())
        {
            arm = xInput.GetAxis("Arm");
        }

        transform.Rotate(new Vector3(0f, 0f, armSpeed * arm * Time.deltaTime));

        if (transform.localRotation.eulerAngles.z > 180)
        {
            transform.localRotation = Quaternion.Euler(
                transform.localRotation.eulerAngles.x,
                transform.localRotation.eulerAngles.y,
                Mathf.Clamp(transform.localRotation.eulerAngles.z, leftLimit, 360f));
        }
        if (transform.localRotation.eulerAngles.z < 180 && transform.localRotation.eulerAngles.z > 0)
        {
            transform.localRotation = Quaternion.Euler(
                transform.localRotation.eulerAngles.x,
                transform.localRotation.eulerAngles.y,
                Mathf.Clamp(transform.localRotation.eulerAngles.z, 0f, rightLimit));
        }

//		traansform.localRotation = Quaternion.Euler (
//			transform.localRotation.eulerAngles.x,
//			transform.localRotation.eulerAngles.y,
//			Mathf.Clamp (transform.localRotation.eulerAngles.z, rightLimit, leftLimit));

        angle = transform.localRotation.eulerAngles;
    }
    // Update is called once per frame
    void Update()
    {
        float vertical   = Input.GetAxis("Vertical");
        float horizontal = Input.GetAxis("Horizontal");
        float rotate     = Input.GetAxis("Rotate");

        if (xInput.IsWorking())
        {
            vertical   = xInput.GetAxis("Vertical");
            horizontal = xInput.GetAxis("Horizontal");
            rotate     = xInput.GetAxis("Rotate");
        }

        drive.frontRight.motorValue = 127f * (vertical - rotate - horizontal);
        drive.frontLeft.motorValue  = 127f * (vertical + rotate + horizontal);
        drive.backRight.motorValue  = -127f * (vertical - rotate + horizontal);
        drive.backLeft.motorValue   = -127f * (vertical + rotate - horizontal);

        angularVelocity = angularSpeed * rotate;
    }
    void Update()
    {
        float lift = Input.GetAxis("Lift");

        if (xInput.IsWorking())
        {
            lift = xInput.GetAxis("Lift");
        }

        float deltaHeight      = (lift > 0)? maxLiftSpeed * lift * Time.deltaTime : maxLowerSpeed * lift * Time.deltaTime;
        float stageDeltaHeight = 0f;

        for (int i = 0; i < numStages; i++)
        {
            stageDeltaHeight = Mathf.Clamp(stageHeights[i] + deltaHeight, 0, maxHeightsPerStage[i]) - stageHeights[i];
            deltaHeight     -= stageDeltaHeight;

            stageHeights[i]    += stageDeltaHeight;
            stages[i].position += new Vector3(0, stageDeltaHeight, 0);
        }
    }