/// <summary> /// Identifies the binocular suppression ratio. /// </summary> /// <returns>The binocular suppression ratio.</returns> /// <param name="ratioController">Ratio controller. Where we get our signal from to alter the ratio - e.g. tilt angle of head</param> /// <param name="model">Model. The model that provides us the conflict images.</param> /// <param name="cameraRig">Camera rig. The cameras whose relative brightness we wish to alter.</param> /// <param name="stillness">Stillness. Where we get information from about whether or not the headset is still. Might have been better to pass this headset specific mechanism to the VRHeadsetInput, which could have implemented a generic interface for reporting "stillness"</param> /// <param name="indicator">Indicator. The element which informs the user about the progress of the stillness based selection</param> /// <param name="NextStep">Next step.</param> /// <param name="secondsOfStillnessForSelect">Seconds of stillness for select.</param> IEnumerator IdentifyBinocularSuppressionRatio(EyeSkillsVRHeadsetInput ratioController, ConflictZoneModel model, EyeSkillsCameraRig cameraRig, EyeSkillsVRHeadsetSelectByStillness stillness, SelectionIndicatorScaler indicator, Action <float> NextStep, float secondsOfStillnessForSelect) { float suppressionRatio = 0; float still = 0; float brightnessRatio; stillness.StartTracking(); //TODO : We probably need a maximum timeout for if the headset never appears to settle! still = stillness.getTimeStill(); while (still < secondsOfStillnessForSelect) { //Update the luminance ratio for each eye brightnessRatio = Mathf.Clamp(ratioController.getVerticalDirection(), -1, 1); cameraRig.SetBinocularSuppressionRatio(brightnessRatio); //redraw the indicator and play a rising tone?!? float percentage = (still / secondsOfStillnessForSelect); //Debug.Log("Percentage still " + percentage); indicator.SetIndicatorPercentage(percentage); yield return(null); still = stillness.getTimeStill(); //Debug.Log("ratio : "+ brightnessRatio + " %:" + percentage); } stillness.StopTracking(); indicator.Reset(); StopConflictEnvironment(); NextStep(suppressionRatio); }
void Update() { // TODO: Turns out this has some issues. It's -1 at the upper extent, and 1 at the lower. It seems to also extend beyond 1/-1 which is shouldn't. // TODO : Really, we want this to be a non-linear control, it should be possible at the extremes to spend longer with more control brightnessRatio = Mathf.Clamp(ratioController.getVerticalDirection(), -1, 1); // Don't over communicate :-) if (Mathf.Abs(previousBrightnessRatio - brightnessRatio) > 0.01) { NetworkManager.instance.SetFloat("brightnessRatio", brightnessRatio); Debug.Log("Brightness Ratio " + brightnessRatio); previousBrightnessRatio = brightnessRatio; } cameraRig.SetBinocularSuppressionRatio(brightnessRatio); //Now lets check to see if the headset if being held still if (!ignoreStillnessSensor) { float still = stillness.getTimeStill(); Debug.Log("Time still " + still); if (still > secondsOfStillnessForSelect) { //Selected! indicator.Reset(); StoreSuppressionRatioAndQuit(); } else { //redraw the indicator and play a rising tone?!? float percentage = (still / secondsOfStillnessForSelect); //Debug.Log("Percentage still " + percentage); indicator.SetIndicatorPercentage(percentage); } } if (esInput.GetShortButtonPress("EyeSkills Confirm") || NetworkManager.instance.GetButton("save")) { StoreSuppressionRatioAndQuit(); } else if (esInput.GetShortButtonPress("EyeSkills Up") || NetworkManager.instance.GetButton("inConflict")) { AudioManager.instance.Say("inConflict"); model.IntoConflict(); } else if (esInput.GetShortButtonPress("EyeSkills Down") || NetworkManager.instance.GetButton("outOfConflict")) { AudioManager.instance.Say("notInConflict"); model.OutOfConflict(); } }
public void Update() { if (!practitionerMode) { //Now lets check to see if the headset if being held still float still = stillness.getTimeStill(); Debug.Log("Time still " + still); if (still > secondsOfStillnessForSelect) { //Selected! indicator.Reset(); StoreAndQuit(); } else { //redraw the indicator and play a rising tone?!? float percentage = (still / secondsOfStillnessForSelect); Debug.Log("Percentage still " + percentage); indicator.SetIndicatorPercentage(percentage); } } if (Input.GetButton("EyeSkills Confirm") || NetworkManager.instance.GetButton("save")) { StoreAndQuit(); } else if (esInput.GetLongButtonPress("EyeSkills Left") || NetworkManager.instance.GetButton("unlockLeft")) { audioManager.Say("LeftStrabismic"); unlockLeftEye(); } else if (esInput.GetLongButtonPress("EyeSkills Right") || NetworkManager.instance.GetButton("unlockRight")) { audioManager.Say("RightStrabismic"); unlockRightEye(); } }