//public virtual bool IsFinished() { // return _finished; //} public virtual void Finish() { PopStage(); _instructionsManager.Stop(); float totalTime = Time.time - _timeStart; QuickVRManager.Log("STAGE FINISHED: " + GetName() + " " + totalTime.ToString("f3")); _coManager.StopCoroutineSet(_coSet); StopAllCoroutines(); if (OnFinish != null) { OnFinish(); } //Look for the nextStage to be executed QuickStageBase nextStage = null; for (int i = transform.GetSiblingIndex() + 1; !nextStage && i < transform.parent.childCount; i++) { Transform t = transform.parent.GetChild(i); if (t.gameObject.activeInHierarchy) { nextStage = transform.parent.GetChild(i).GetComponent <QuickStageBase>(); } } if (nextStage) { nextStage.Init(); } enabled = false; }
public static void PrintStackStages() { QuickVRManager.Log("======================================"); foreach (QuickStageBase stage in _stackStages) { QuickVRManager.Log(stage.name); } QuickVRManager.Log("======================================"); }
public static void LoadFromXml(this ScriptableObject obj, string path) { if (path.Length == 0) { return; } XmlDocument doc = new XmlDocument(); doc.Load(path); QuickVRManager.Log("path = " + path); LoadClass(obj, (XmlElement)doc.FirstChild.FirstChild); }
protected virtual void OnFinishStagesPre() { _state = State.StagesMain; QuickVRManager.Log("APPLICATION READY"); QuickVRManager.Log("Time.time = " + Time.time); if (OnRunning != null) { OnRunning(); } //Execute the stagesMain _timeRunning = 0.0f; }
public virtual void Init() { PushStage(this); enabled = true; _timeStart = Time.time; QuickVRManager.Log("RUNNING STAGE: " + GetName()); if (OnInit != null) { OnInit(); } StartCoroutine(CoUpdateBase()); }
public virtual void Finish() { if (_state != State.StagesPost) { _state = State.StagesPost; //Kill the pre and main stages _stagesPre.gameObject.SetActive(false); _stagesMain.gameObject.SetActive(false); QuickSingletonManager.GetInstance <QuickInstructionsManager>().Stop(); QuickStageBase.ClearStackStages(); QuickVRManager.Log("Elapsed Time = " + _timeRunning.ToString("f3") + " seconds"); _stagesPost.Init(); } }
protected virtual IEnumerator CoUpdate() { //Check if the game has expired bool gameExpired = false; if (_useExpirationDate) { if (!QuickUtils.IsInternetConnection()) { _guiCalibration.SetCalibrationInstructions(QuickUserGUICalibration.CalibrationStep.InternetConnectionRequired); gameExpired = true; } else { int day, month, year; QuickUtils.GetDateOnline(out day, out month, out year); DateTime timeNow = new DateTime(year, month, day); DateTime timeExp = new DateTime(_expirationYear, _expirationMonth, _expirationDay); if (timeNow >= timeExp) { _guiCalibration.SetCalibrationInstructions(QuickUserGUICalibration.CalibrationStep.TimeExpired); gameExpired = true; QuickVRManager.Log("GAME DATE EXPIRED!!!"); } } } if (gameExpired) { while (!InputManager.GetButtonDown(InputManager.DEFAULT_BUTTON_CONTINUE)) { yield return(null); } QuickUtils.CloseApplication(); } else { //Execute the stagesPre _state = State.StagesPre; _stagesPre.Init(); } }
public static DateTime GetDateOnline() { var myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com"); try { var response = myHttpWebRequest.GetResponse(); string todaysDates = response.Headers["date"]; return(DateTime.ParseExact(todaysDates, "ddd, dd MMM yyyy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture.DateTimeFormat, DateTimeStyles.AssumeUniversal)); } catch { QuickVRManager.Log("NO INTERNET CONNECTION!!!"); return(new DateTime()); } }
public virtual void Calibrate() { //POSSIBLE TRACKER CONFIGURATIONS //1 -> Head //3 -> Head + Hands //4 -> Head + Hands + Hips //6 -> Head + Hands + Hips + Feet //10 -> Head + Hands + Hips + Feet + Elbows + Knees _isHandsSwaped = false; List <InputDevice> bodyTrackers = GetBodyTrackers(); int numTrackers = bodyTrackers.Count; QuickVRManager.Log("NUM BODY TRACKERS = " + numTrackers); //Try to assign the default nodes for Head and Hands QuickVRNode nodeHMD = GetVRNode(HumanBodyBones.Head); QuickVRNode nodeLeftHand = GetVRNode(HumanBodyBones.LeftHand); QuickVRNode nodeRightHand = GetVRNode(HumanBodyBones.RightHand); nodeHMD._inputDevice = InputDevices.GetDeviceAtXRNode(XRNode.Head); nodeLeftHand._inputDevice = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand); nodeRightHand._inputDevice = InputDevices.GetDeviceAtXRNode(XRNode.RightHand); if (numTrackers == 1 || numTrackers == 3 || numTrackers == 4 || numTrackers == 6 || numTrackers == 10) { if (!nodeHMD._inputDevice.isValid) { //The head will always be the upper body tracker nodeHMD._inputDevice = bodyTrackers[0]; } if (numTrackers == 3) { //Head + Hands if (!nodeLeftHand._inputDevice.isValid) { nodeLeftHand._inputDevice = bodyTrackers[1]; } if (!nodeRightHand._inputDevice.isValid) { nodeRightHand._inputDevice = bodyTrackers[2]; } } //else if (numTrackers == 4) //{ // //Head + Hands + Hips // //1) Remove the head node from the list // bodyTrackers.RemoveAt(0); // //2) The hips is the node that is "in the middle", i.e., the hands are in opposite sides of the hips node. // InitHipsAndHands(bodyTrackers); //} //else if (numTrackers == 6) //{ // //Head + Hands + Hips + Feet // //1) The Feet are the trackers with the lower y // InitVRNode(HumanBodyBones.LeftFoot, bodyTrackers[5]); // InitVRNode(HumanBodyBones.RightFoot, bodyTrackers[4]); // //2) Remove the unnecessary nodes and proceed as in the previous case // bodyTrackers.RemoveAt(5); // bodyTrackers.RemoveAt(4); // bodyTrackers.RemoveAt(0); // InitHipsAndHands(bodyTrackers); //} //UpdateVRNodes(); //IsVRNodesSwaped(HumanBodyBones.LeftFoot, HumanBodyBones.RightFoot); } else { QuickVRManager.LogWarning("BAD NUMBER OF BODY TRACKERS!!!"); } UpdateVRNodes(); _isHandsSwaped = IsVRNodesSwaped(HumanBodyBones.LeftHand, HumanBodyBones.RightHand); QuickVRManager.Log("handsSwaped = " + _isHandsSwaped); foreach (HumanBodyBones t in QuickVRNode.GetTypeList()) { QuickVRNode n = GetVRNode(t); if (n) { n.Calibrate(); } } }