public SetVerticalFOV ( float verticalFOV ) : void | ||
verticalFOV | float | |
return | void |
// UpdateFOV void UpdateFOV() { if (Input.GetKeyDown(KeyCode.LeftBracket)) { float cfov = 0; CameraController.GetVerticalFOV(ref cfov); cfov -= FOVIncrement; CameraController.SetVerticalFOV(cfov); } else if (Input.GetKeyDown(KeyCode.RightBracket)) { float cfov = 0; CameraController.GetVerticalFOV(ref cfov); cfov += FOVIncrement; CameraController.SetVerticalFOV(cfov); } if (ShowVRVars == true) // limit gc { float cfov = 0; CameraController.GetVerticalFOV(ref cfov); strFOV = System.String.Format("FOV (deg): {0:F3}", cfov); } }
void HandleBoost() { // hack fix by pasting object find before every use // shouldn't need to do this since new one gets assigned in AttachCorrectCameraModule, isn't the function atomic? GameObject[] tempCameraObjectArray = GameObject.FindGameObjectsWithTag("MainCamera"); mainCameraComponentList.Clear(); for (int i = 0; i < tempCameraObjectArray.Length; i++) { mainCameraComponentList.Add((Camera)tempCameraObjectArray[i].GetComponent("Camera")); } foreach (Camera mainCameraComponent in mainCameraComponentList) { currentFieldOfView = mainCameraComponent.fieldOfView; if (currentFieldOfView < boostTreasholdArray[0]) { boostStage = 0; } else if (currentFieldOfView < boostTreasholdArray[1]) { boostStage = 1; } else { boostStage = 2; } float boostFactor = 0; boostFactor = boostFactorArray[boostStage]; currentBoostFactor = boostFactor; if (isOVR) { boostFactor = boostFactor / 3.0f; } if (Input.GetButton("Warp") || isLMCWarping == true) { energyCounter += Time.deltaTime * boostFactor; } else { if (boostStage == 0) { energyCounter -= Time.deltaTime * 1.5f * boostFactor; } else if (boostStage == 1) { energyCounter -= Time.deltaTime * boostFactor; } else if (boostStage == 2) { energyCounter -= Time.deltaTime * 2.0f * boostFactor; } if (energyCounter < 0) { energyCounter = 0; } } float rgbValue = energyCounter / (181 - originalFieldOfView); //Debug.Log(energyCounter); if (originalFieldOfView + energyCounter < 180) { mainCameraComponent.fieldOfView = originalFieldOfView + energyCounter; mainCameraComponent.backgroundColor = new Color(rgbValue, rgbValue, rgbValue, rgbValue); if (isOVR) { ovrCameraController.SetVerticalFOV(1.5f * mainCameraComponent.fieldOfView); ovrCameraController.BackgroundColor = 1.5f * mainCameraComponent.backgroundColor; } } } }