// Use this for initialization void Start() { GUIControl = new OVRGUI(); OVRCameraController camCont = GetComponent<OVRCameraController>(); GUIControl.SetCameraController (ref(camCont)); theString = "TEXT"; }
/// <summary> /// GUIs the mag yaw drift correction. /// </summary> /// <param name="xLoc">X location.</param> /// <param name="yLoc">Y location.</param> /// <param name="xWidth">X width.</param> /// <param name="yWidth">Y width.</param> /// <param name="guiHelper">GUI helper.</param> 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.MagUncalibrated): strMagCal = "Mag Uncalibrated"; break; case (MagCalibrationState.MagDisabled): strMagCal = "Mag Calibration OFF"; break; case (MagCalibrationState.MagReady): strMagCal = "Mag Correction ON"; c = Color.red; break; } guiHelper.StereoBox(xloc, yLoc, xwidth, yWidth, ref strMagCal, c); }
// 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.MagUncalibrated): strMagCal = "Mag Uncalibrated"; break; case(MagCalibrationState.MagDisabled): strMagCal = "Mag Calibration OFF"; break; case(MagCalibrationState.MagReady): strMagCal = "Mag Correction ON"; c = Color.red; break; } guiHelper.StereoBox (xloc, yLoc, xwidth, yWidth, ref strMagCal, c); }
// Use this for initialization void Start() { cleanupCameras(); ovrGui = new OVRGUI(); ovrGui.SetCameraController(ref cameraController); ovrGui.SetFontReplace(timeFont); cubes = new GameObject[numCubes]; for (int i = 0; i < numCubes; i++) { Vector3 position = Random.onUnitSphere * Random.Range(maxDistance / 2, maxDistance); GameObject o = GameObject.Instantiate(cube, position, Quaternion.identity) as GameObject; BlinkySorty bs = o.GetComponent <BlinkySorty>(); bs.leftCamera = cameraLeft; bs.numBlinks = (int)Random.Range(1, 7); cubes[i] = o; } dest = ovrParent.transform.position; userSort = new ArrayList(); }
// 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); }
// 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 -= 75; 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 -= 75; xwidth += 150; break; case(MagCalibrationState.MagReady): if(OVRDevice.IsMagYawCorrectionInProgress(0) == true) { if(MagCalTimerFlash > 0.2f) { strMagCal = "Mag CORRECTING..."; } MagCalTimerFlash -= Time.deltaTime; if(MagCalTimerFlash < 0.0f) MagCalTimerFlash += 0.5f; xloc -= 75; xwidth += 150; c = Color.green; } else { strMagCal = "Mag Correction ON"; c = Color.red; } break; } guiHelper.StereoBox (xloc, yLoc, xwidth, yWidth, ref strMagCal, c); }
//Called in OVRMainMenu.cs public void OculusGUI(ref OVRGUI GuiHelper) { if (!oculusEnabled) return; //In-game UI //Reticule (replaced by 3d object) //GuiHelper.StereoDrawTexture((int)(screenWidth / 2 - reticuleSize / 2), (int)(screenHeight / 2 - reticuleSize / 2), (int)reticuleSize, (int)reticuleSize, ref reticule, Color.white); //Health string hp = Player.getHP().ToString("F0"); GuiHelper.StereoBox((int)screenWidth / 2 - 30, (int)screenHeight / 4 - 10, 60, 20, ref hp, Color.red); //Ammo string ammo = Player.getAmmo().ToString("F0"); GuiHelper.StereoBox((int)screenWidth / 2 - 30, (int)screenHeight / 4 * 3 - 10 - 40, 60, 20, ref ammo, Color.blue); //Framerate if (showFramerate) GUI.Label(new Rect(600, 240, 400, 400), (1 / Time.deltaTime).ToString("F4")); if (showMinimap) { GUI.color = minimapTint; //Minimap GuiHelper.StereoDrawTexture((int)(minimapLocation.x), (int)(minimapLocation.y), (int)minimapLocation.width, (int)minimapLocation.height, ref minimap, Color.white); GUI.color = Color.white; //Indicator Rect indicatorLocation = new Rect(minimapLocation.xMin + minimapLocation.width / 2 + (player.transform.position.x / gameworldSize * minimapSize / 2) - indicatorSize / 2, minimapLocation.yMin + minimapLocation.height / 2 - (player.transform.position.z / gameworldSize * minimapSize / 2) - indicatorSize / 2, indicatorSize, indicatorSize); //Rect pivot = new Rect(); //GuiHelper.CalcPositionAndSize(minimapLocation.xMin + minimapLocation.width / 2 + (player.transform.position.x / gameworldSize * minimapSize / 2), minimapLocation.yMin + minimapLocation.height / 2 - (player.transform.position.z / gameworldSize * minimapSize / 2), indicatorSize, indicatorSize, ref pivot); //Matrix4x4 backup = GUI.matrix; //GUIUtility.RotateAroundPivot(player.transform.eulerAngles.y, new Vector2(pivot.x, pivot.y)); GuiHelper.StereoDrawTexture((int)(indicatorLocation.x), (int)(indicatorLocation.y), (int)indicatorLocation.width, (int)indicatorLocation.height, ref minimapIndicator, Color.white); //GUI.matrix = backup; } //Overlay menu if (showingMenu) { GuiHelper.StereoDrawTexture(0, 0, (int)screenWidth, (int)screenHeight, ref bg, Color.white); switch (menuSelection) { case 0: GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[0], Color.red); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[1], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[2], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[3], Color.white); break; case 1: GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[0], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[1], Color.red); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[2], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[3], Color.white); break; case 2: GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[0], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[1], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[2], Color.red); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[3], Color.white); break; case 3: GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[0], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[1], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 20), (int)menuItem.width, (int)menuItem.height, ref menuOptions[2], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 60), (int)menuItem.width, (int)menuItem.height, ref menuOptions[3], Color.red); break; } } else if (showingDeathScreen) { //GUI.Box(new Rect((int)0, (int)0, (int)screenWidth, (int)screenHeight), "", background); GuiHelper.StereoDrawTexture(0, 0, (int)screenWidth, (int)screenHeight, ref bg, Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y - 80), (int)menuItem.width, (int)menuItem.height, ref deathString, Color.red); switch (menuSelection) { case 0: GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 0), (int)menuItem.width, (int)menuItem.height, ref deathOptions[0], Color.red); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 40), (int)menuItem.width, (int)menuItem.height, ref deathOptions[1], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 80), (int)menuItem.width, (int)menuItem.height, ref deathOptions[2], Color.white); break; case 1: GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 0), (int)menuItem.width, (int)menuItem.height, ref deathOptions[0], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 40), (int)menuItem.width, (int)menuItem.height, ref deathOptions[1], Color.red); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 80), (int)menuItem.width, (int)menuItem.height, ref deathOptions[2], Color.white); break; case 2: GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 0), (int)menuItem.width, (int)menuItem.height, ref deathOptions[0], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 40), (int)menuItem.width, (int)menuItem.height, ref deathOptions[1], Color.white); GuiHelper.StereoBox((int)menuItem.x, (int)(menuItem.y + 80), (int)menuItem.width, (int)menuItem.height, ref deathOptions[2], Color.red); break; } } }
// Use this for initialization void Start() { ovrGui = new OVRGUI(); ovrGui.SetCameraController(ref cameraController); ovrGui.SetFontReplace(timeFont); }
// 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 " + manualCalibrationKey.ToString(); c = Color.white; xloc -= 75; 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 -= 75; xwidth += 150; break; case (MagCalibrationState.MagReady): if (OVRDevice.IsMagYawCorrectionInProgress(0) == true) { if (MagCalTimerFlash > 0.2f) { strMagCal = "Mag CORRECTING..."; } MagCalTimerFlash -= Time.deltaTime; if (MagCalTimerFlash < 0.0f) { MagCalTimerFlash += 0.5f; } xloc -= 75; xwidth += 150; c = Color.green; } else { strMagCal = "Mag Correction ON"; c = Color.red; } break; } guiHelper.StereoBox(xloc, yLoc, xwidth, yWidth, ref strMagCal, c); }
// Use this for initialization void Start() { gui = new OVRGUI(); player = GameObject.Find("OVRPlayerController"); initPlanets(); positionPlanets(); currentPlanet = planets[Planets.Sun]; movePlayerToPlanet(Planets.Sun); }