예제 #1
0
    // GUIMagYawDriftCorrection
    public void GUIMagYawDriftCorrection(int xLoc, int yLoc,
                                         int xWidth, int yWidth,
                                         ref OVRGUI guiHelper)
    {
        string strMagCal = "";
        Color  c         = Color.red;
        int    xloc      = xLoc;
        int    xwidth    = xWidth;

        switch (MagCalState)
        {
        case (MagCalibrationState.MagDisabled):
            strMagCal = "Mag Calibration OFF";
            break;

        case (MagCalibrationState.MagManualGetReady):
            strMagCal = "Manual Calibration: Look Forward, Press 'Z'..";
            c         = Color.white;
            xloc     -= 40;
            xwidth   += 150;
            break;

        case (MagCalibrationState.MagCalibrating):
            if (MagCalTimerFlash > 0.2f)
            {
                FormatCalibratingString(ref strMagCal);
            }

            MagCalTimerFlash -= Time.deltaTime;
            if (MagCalTimerFlash < 0.0f)
            {
                MagCalTimerFlash += 0.5f;
            }

            c       = Color.white;
            xloc   -= 40;
            xwidth += 150;
            break;

        case (MagCalibrationState.MagCalibrated):
            strMagCal         = "Mag Calibrated";
            MagCalTimerFlash -= Time.deltaTime;
            if (MagCalTimerFlash < 0.0f)
            {
                MagCalTimerFlash += 0.5f;
            }

            c = Color.yellow;
            break;

        case (MagCalibrationState.MagReady):
            if (OVRDeviceImposter.IsMagYawCorrectionInProgress(0) == true)
            {
                if (MagCalTimerFlash > 0.2f)
                {
                    strMagCal = "Mag CORRECTING...";
                    strMagCal = System.String.Format("Mag CORRECTING (deg)... {0:F3}",
                                                     OVRDeviceImposter.GetYawErrorAngle(0));
                }

                MagCalTimerFlash -= Time.deltaTime;
                if (MagCalTimerFlash < 0.0f)
                {
                    MagCalTimerFlash += 0.5f;
                }

                xloc   -= 40;
                xwidth += 150;

                c = Color.red;
            }
            else
            {
                strMagCal = "Mag Correction ON";
                c         = Color.green;
            }

            break;
        }

        guiHelper.StereoBox(xloc, yLoc, xwidth, yWidth, ref strMagCal, c);
    }