//I set this axis as the base axis, then I just need to know how much rotation from that axis this experiences.  I need to treat anything over 180 as negative value
    private void TellStandMowerRotation()
    {
        if (this.gameObject.activeSelf && !mLockControls)
        {
            Vector3 tempVector = Vector3.zero;
            tempVector.x = ConvertToRotationAmount(transform.rotation.eulerAngles.x);
            tempVector.y = ConvertToRotationAmount(transform.rotation.eulerAngles.y);
            tempVector.z = ConvertToRotationAmount(transform.rotation.eulerAngles.z);

            SerialPortEventManager.ChangeRotation(tempVector, mIsIMUAvailable);
        }
    }
Esempio n. 2
0
    void Update()
    {
        if (mIsActiveMenu)
        {
            if (mButtons.Count > 0)
            {
                if (mActionButtons[2])  //TODO move this assignement to higher up for cleaner code
                {
                    SelectCurrentButton();
                }

                if (mLeftAxisValue != 0)
                {
                    if (mLeftAxisValue > 0)
                    {
                        if (Time.time >= mNextSelectionTime)
                        {
                            mCurrentButtonInt--;
                            ChangeActiveButton();
                        }
                    }
                    else if (mLeftAxisValue < 0)
                    {
                        if (Time.time >= mNextSelectionTime)
                        {
                            mCurrentButtonInt++;
                            ChangeActiveButton();
                        }
                    }
                }
            }

            if (mLocksControlWhenActive)
            {
                SerialPortEventManager.ChangeRotation(Vector3.zero, false);
            }
        }
    }