// Update is called once per frame void Update() { // track time inputtime += Time.deltaTime; if (Input.GetKeyDown("space") || m_GripAction.GetStateDown(m_Pose.inputSource)) { SceneManager.LoadScene("3DAuthenticationSchemeTappingOnly"); started = false; stopped = false; } if (m_GrabAction.GetStateDown(m_Pose.inputSource) && !started) { fw.StartRecording(); //Debug.Log("recording started"); started = true; mdfw.StartRecording(); inputtime = 0; mdfw.WriteToFileCsv(new DataModel(inputtime, passwordmodel.getUserInput())); } else if (m_GrabAction.GetStateDown(m_Pose.inputSource) && started && !stopped) { Debug.Log("writing"); mdfw.WriteToFileCsv(new DataModel(inputtime, passwordmodel.getUserInput())); } if (hand.Userinput.Count == 4 && !stopped) { mdfw.WriteToFileCsv(new DataModel(inputtime, passwordmodel.getUserInput())); stopped = true; List <String> userinputStrings = new List <String>(); foreach (var userinput in hand.Userinput) { Debug.Log(userinput); userinputStrings.Add(userinput.name); passwordmodel.backupInput(userinput.name); } //passwordmodel.checkPassword(userinputStrings); passwordmodel.entryError(userinputStrings); Debug.Log("recording stopped"); fw.StopRecording(); mdfw.StopRecording(); if (passwordmodel.getErrors() == 0) { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("Interactable")) { pin.GetComponent <MeshRenderer>().material = _pincorrect; } } else { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("Interactable")) { pin.GetComponent <MeshRenderer>().material = _pinwrong; } } } }
private void Update() { if (Input.inputString == "x") { fullfw.StopRecording(); fw.StopRecording(); } if ((Input.inputString == "1" || m_GripAction.GetStateDown(m_Pose.inputSource)) && stopped) //Input.inputString == "2" || //Input.inputString == "3" || //Input.inputString == "4" || //Input.inputString == "5" || //Input.inputString == "6") { fullfw.StopRecording(); fw.StopRecording(); Debug.Log(trials + "versuche"); if (trials == 0) { GameObject.Find("Controller (left)").SetActive(false); return; } trials--; foreach (MaterialHolder materialobj in materialholderList) { //Debug.Log("test"); // Debug.Log(materialobj.Material); // Debug.Log(materialobj.Gameobject); //Debug.Log(_pincorrect); materialobj.Gameobject.GetComponent <MeshRenderer>().material = materialobj.Material; //materialobj.Gameobject.GetComponent<MeshRenderer>().material = _pincorrect; } Init(); } /* if (Input.inputString == "4") { * // rotate cube * // get side area (in this case left) * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(0, 270, -90); * } * if (Input.inputString == "5") * { * // rotate cube * // get back area * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(-90, 270, -90); * } * if (Input.inputString == "6") * { * // rotate cube * // bet bottom area * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(180, 180, 0); * }*/ // track time inputtime += Time.deltaTime; fullinputtime += Time.deltaTime; //if (m_GripAction.GetStateDown(m_Pose.inputSource)) //{ // GameObject.Find("Planes").transform.Rotate(0, 180, 0); // } if (_eyeTracker.Connected) { var latestHitObject = _gazeTrail.LatestHitObject; if (latestHitObject != null && latestHitObject.name.StartsWith("POS") && m_GrabAction.GetStateDown(m_Pose.inputSource) && !stopped) { if (!started) { // when to start with recording by using dwell time? fw.StartRecording(); mdfw.StartRecording(); started = true; inputtime = 0; } mdfw.WriteToFileCsv(new DataModel(inputtime, latestHitObject.name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, latestHitObject.name)); passwordmodel.backupInput(latestHitObject.name); selectedPINS.Add(latestHitObject.name); if (selectedPINS.Count == 4) { stopped = true; passwordmodel.entryError(selectedPINS); mdfw.WriteToFileCsv(new DataModel(inputtime, "correct password: "******"correct password: "******"PIN")) { pin.GetComponent <MeshRenderer>().material = _pincorrect; } } else if (selectedPINS.Count == 4) { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("PIN")) { pin.GetComponent <MeshRenderer>().material = _pinwrong; } } } } _gazeTrail.ParticleColor = Color.blue; }
// Update is called once per frame void Update() { if (Input.inputString == "x") { fullfw.StopRecording(); fw.StopRecording(); } if ((Input.inputString == "1" || m_GripAction.GetStateDown(m_Pose.inputSource)) && stopped) //Input.inputString == "2" || //Input.inputString == "3" || //Input.inputString == "4" || //Input.inputString == "5" || //Input.inputString == "6") { fullfw.StopRecording(); fw.StopRecording(); Debug.Log(trials + "versuche"); if (trials == 0) { GameObject.Find("Controller (left)").SetActive(false); return; } trials--; foreach (MaterialHolder materialobj in materialholderList) { materialobj.Gameobject.GetComponent <MeshRenderer>().material = materialobj.Material; } Init(); } /*if (Input.inputString == "4") * { * // rotate cube * // get side area (in this case left) * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(0, 270, -90); * } * if (Input.inputString == "5") * { * // rotate cube * // get back area * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(-90, 270, -90); * } * if (Input.inputString == "6") * { * // rotate cube * // bet bottom area * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(180, 180, 0); * }*/ // track time inputtime += Time.deltaTime; fullinputtime += Time.deltaTime; // Down Vector3 origin = GameObject.Find("Camera").transform.position; Vector3 direction = GameObject.Find("HeadPosePoint").transform.forward; Debug.DrawRay(origin, direction * 10f, Color.red); Ray ray = new Ray(origin, direction); //if (m_GripAction.GetStateDown(m_Pose.inputSource)) //{ // GameObject.Find("Planes").transform.Rotate(0, 180, 0); // } if (Physics.Raycast(ray, out RaycastHit raycastHit)) { if (m_GrabAction.GetStateDown(m_Pose.inputSource) && raycastHit.transform.tag == "Interactable" && !started && !stopped) { Debug.Log("zuhuu"); fw.StartRecording(); started = true; mdfw.StartRecording(); inputtime = 0; passwordmodel.backupInput(raycastHit.transform.name); mdfw.WriteToFileCsv(new DataModel(inputtime, raycastHit.transform.name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, raycastHit.transform.name)); raycastHit.collider.GetComponent <MeshRenderer>().material = tapped; Userinput.Add(raycastHit.transform.gameObject); } else if (m_GrabAction.GetStateDown(m_Pose.inputSource) && raycastHit.transform.tag == "Interactable" && started && !stopped) { passwordmodel.backupInput(raycastHit.transform.name); raycastHit.collider.GetComponent <MeshRenderer>().material = tapped; Userinput.Add(raycastHit.transform.gameObject); mdfw.WriteToFileCsv(new DataModel(inputtime, raycastHit.transform.name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, raycastHit.transform.name)); } } //Up //workaround bug Debug.Log(Userinput.Count); if (Userinput.Count == 4 && !stopped) { stopped = true; List <String> userinputStrings = new List <String>(); foreach (var userinput in Userinput) { userinputStrings.Add(userinput.name); } //passwordmodel.checkPassword(userinputStrings); passwordmodel.entryError(userinputStrings); Debug.Log("password fehler" + passwordmodel.getErrors()); mdfw.WriteToFileCsv(new DataModel(inputtime, "correct password: "******"correct password: "******"recording stopped"); // fw.StopRecording(); mdfw.StopRecording(); //fullfw.StopRecording(); fullmdfw.StopRecording(); if (passwordmodel.getErrors() == 0) { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("Interactable")) { pin.GetComponent <MeshRenderer>().material = _pincorrect; } } else { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("Interactable")) { pin.GetComponent <MeshRenderer>().material = _pinwrong; } } } }
// Update is called once per frame void Update() { if (Input.inputString == "x") { fullfw.StopRecording(); fw.StopRecording(); } if ((Input.inputString == "1" || m_GripAction.GetStateDown(m_Pose.inputSource)) && stopped) //Input.inputString == "2" || //Input.inputString == "3" || //Input.inputString == "4" || //Input.inputString == "5" || //Input.inputString == "6") { fullfw.StopRecording(); fw.StopRecording(); Debug.Log(trials + "versuche"); if (trials == 0) { GameObject.Find("Controller (left)").SetActive(false); return; } trials--; //if (!stopped) // { // mdfw.StopRecording(); // fullmdfw.StopRecording(); // stopped = true; // } //SceneManager.LoadScene("3DAuthenticationSchemeGazeTrigger"); foreach (MaterialHolder materialobj in materialholderList) { //Debug.Log("test"); // Debug.Log(materialobj.Material); // Debug.Log(materialobj.Gameobject); //Debug.Log(_pincorrect); materialobj.Gameobject.GetComponent <MeshRenderer>().material = materialobj.Material; //materialobj.Gameobject.GetComponent<MeshRenderer>().material = _pincorrect; } Init(); } /*if (Input.inputString == "4") * { * // rotate cube * // get side area (in this case left) * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(0, 270, -90); * } * if (Input.inputString == "5") * { * // rotate cube * // get back area * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(-90, 270, -90); * } * if (Input.inputString == "6") * { * // rotate cube * // bet bottom area * GameObject.Find("Planes").transform.localRotation = Quaternion.Euler(180, 180, 0); * } */ // track time inputtime += Time.deltaTime; fullinputtime += Time.deltaTime; //if (m_GripAction.GetStateDown(m_Pose.inputSource)) //{ // GameObject.Find("Planes").transform.Rotate(0, 180, 0); // } // Down if (m_GrabAction.GetStateDown(m_Pose.inputSource) && !started && !stopped) { if (current != null && GetNearestGameObject() != null) { fw.StartRecording(); //Debug.Log("recording started"); started = true; mdfw.StartRecording(); inputtime = 0; passwordmodel.backupInput(GetNearestGameObject().name); mdfw.WriteToFileCsv(new DataModel(inputtime, GetNearestGameObject().name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, GetNearestGameObject().name)); GetNearestGameObject().GetComponent <MeshRenderer>().material = tapped; Userinput.Add(GetNearestGameObject()); } //call method Input(); //Pickup(); } //Up else if (m_GrabAction.GetStateDown(m_Pose.inputSource) && started && !stopped) { if (current != null && GetNearestGameObject() != null) { passwordmodel.backupInput(GetNearestGameObject().name); GetNearestGameObject().GetComponent <MeshRenderer>().material = tapped; Userinput.Add(GetNearestGameObject()); mdfw.WriteToFileCsv(new DataModel(inputtime, GetNearestGameObject().name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, GetNearestGameObject().name)); } } //workaround bug Debug.Log(Userinput.Count); if (Userinput.Count == 4 && !stopped) { stopped = true; List <String> userinputStrings = new List <String>(); foreach (var userinput in Userinput) { userinputStrings.Add(userinput.name); } //passwordmodel.checkPassword(userinputStrings); passwordmodel.entryError(userinputStrings); mdfw.WriteToFileCsv(new DataModel(inputtime, "correct password: "******"correct password: "******"recording stopped"); // fw.StopRecording(); mdfw.StopRecording(); //fullfw.StopRecording(); fullmdfw.StopRecording(); if (passwordmodel.getErrors() == 0) { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("Interactable")) { pin.GetComponent <MeshRenderer>().material = _pincorrect; } } else { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("Interactable")) { pin.GetComponent <MeshRenderer>().material = _pinwrong; } } } }
private void Update() { if (m_GripAction.GetStateDown(m_Pose.inputSource)) { trials++; foreach (MaterialHolder materialobj in materialholderList) { materialobj.Gameobject.GetComponent <MeshRenderer>().material = materialobj.Material; } Init(); } if (Input.inputString == "e" || Input.inputString == "m" || Input.inputString == "s") { trials = 0; foreach (GameObject pin in GameObject.FindGameObjectsWithTag("PIN")) { pin.GetComponent <MeshRenderer>().enabled = true; } Canvas weakpw = GameObject.Find("weakpw").GetComponent <Canvas>(); Canvas mediumpw = GameObject.Find("mediumpw").GetComponent <Canvas>(); Canvas strongpw = GameObject.Find("strongpw").GetComponent <Canvas>(); // toggle display instruction fullfw.StopRecording(); fullmdfw.StopRecording(); foreach (MaterialHolder materialobj in materialholderList) { materialobj.Gameobject.GetComponent <MeshRenderer>().material = materialobj.Material; } Init(); if (Input.inputString == "e") { weakpw.enabled = true; mediumpw.enabled = false; strongpw.enabled = false; security = "weak"; } else if (Input.inputString == "m") { weakpw.enabled = false; mediumpw.enabled = true; strongpw.enabled = false; security = "medium"; } else if (Input.inputString == "s") { weakpw.enabled = false; mediumpw.enabled = false; strongpw.enabled = true; security = "strong"; } } // track time inputtime += Time.deltaTime; fullinputtime += Time.deltaTime; Vector3 origin = GameObject.Find("Camera").transform.position; //Debug.Log(origin); //Debug.Log("direction "+direction); var latestHitObject = _gazeTrail.LatestHitObject; if (latestHitObject != null && latestHitObject.name.StartsWith("POS") && m_GrabAction.GetStateDown(m_Pose.inputSource) && !stopped && GlobalHandler.modality == 0) { if (!started) { // when to start with recording by using dwell time? fw.StartRecording(); mdfw.StartRecording(); started = true; inputtime = 0; } mdfw.WriteToFileCsv(new DataModel(inputtime, latestHitObject.name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, latestHitObject.name)); passwordmodel.backupInput(latestHitObject.name); selectedPINS.Add(latestHitObject.name); if (selectedPINS.Count == 4) { mdfw.WriteToFileCsv(new DataModel(inputtime, "status: " + security)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, "status: " + security)); mdfw.StopRecording(); fullmdfw.StopRecording(); fw.StopRecording(); fullfw.StopRecording(); } feedbackElements.Add(new FeedbackModel(latestHitObject.gameObject, latestHitObject.gameObject.GetComponent <MeshRenderer>().material, feedbacktime)); MeshRenderer renderer = latestHitObject.gameObject.GetComponent <MeshRenderer>(); renderer.material = _pinhighlight; } else if (m_GrabAction.GetStateDown(m_Pose.inputSource) && !started && !stopped && current != null && GetNearestGameObject() != null && GlobalHandler.modality == 2) { Debug.Log("teeeeeeeeeeeeeeeeeeeeeeest"); fw.StartRecording(); //Debug.Log("recording started"); started = true; mdfw.StartRecording(); inputtime = 0; passwordmodel.backupInput(GetNearestGameObject().name); selectedPINS.Add(GetNearestGameObject().name); mdfw.WriteToFileCsv(new DataModel(inputtime, GetNearestGameObject().name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, GetNearestGameObject().name)); if (selectedPINS.Count == 4) { mdfw.WriteToFileCsv(new DataModel(inputtime, "status: " + security)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, "status: " + security)); mdfw.StopRecording(); fullmdfw.StopRecording(); fw.StopRecording(); fullfw.StopRecording(); } feedbackElements.Add(new FeedbackModel(GetNearestGameObject(), GetNearestGameObject().GetComponent <MeshRenderer>().material, feedbacktime)); MeshRenderer renderer = GetNearestGameObject().GetComponent <MeshRenderer>(); renderer.material = _pinhighlight; Userinput.Add(GetNearestGameObject()); //call method Input(); //Pickup(); } //Up else if (m_GrabAction.GetStateDown(m_Pose.inputSource) && started && !stopped && current != null && GetNearestGameObject() != null && GlobalHandler.modality == 2) { passwordmodel.backupInput(GetNearestGameObject().name); feedbackElements.Add(new FeedbackModel(GetNearestGameObject(), GetNearestGameObject().GetComponent <MeshRenderer>().material, feedbacktime)); MeshRenderer renderer = GetNearestGameObject().GetComponent <MeshRenderer>(); renderer.material = _pinhighlight; Userinput.Add(GetNearestGameObject()); selectedPINS.Add(GetNearestGameObject().name); mdfw.WriteToFileCsv(new DataModel(inputtime, GetNearestGameObject().name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, GetNearestGameObject().name)); if (selectedPINS.Count == 4) { mdfw.WriteToFileCsv(new DataModel(inputtime, "status: " + security)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, "status: " + security)); mdfw.StopRecording(); fullmdfw.StopRecording(); fw.StopRecording(); fullfw.StopRecording(); } } else if (GameObject.Find("HeadPosePoint") != null) { Vector3 direction = GameObject.Find("HeadPosePoint").transform.forward; Debug.DrawRay(origin, direction * 10f, Color.red); Ray ray = new Ray(origin, direction); if (Physics.Raycast(ray, out RaycastHit raycastHit) && GlobalHandler.modality == 1) { if (m_GrabAction.GetStateDown(m_Pose.inputSource) && raycastHit.transform.tag == "PIN" && !stopped) { Debug.Log("ok this is fine"); if (!started) { fw.StartRecording(); mdfw.StartRecording(); started = true; inputtime = 0; } passwordmodel.backupInput(raycastHit.transform.name); selectedPINS.Add(raycastHit.transform.name); mdfw.WriteToFileCsv(new DataModel(inputtime, raycastHit.transform.name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, raycastHit.transform.name)); if (selectedPINS.Count == 4) { mdfw.WriteToFileCsv(new DataModel(inputtime, "status: " + security)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, "status: " + security)); mdfw.StopRecording(); fullmdfw.StopRecording(); fw.StopRecording(); fullfw.StopRecording(); } feedbackElements.Add(new FeedbackModel(raycastHit.collider.gameObject, raycastHit.collider.GetComponent <MeshRenderer>().material, feedbacktime)); MeshRenderer renderer = raycastHit.collider.gameObject.GetComponent <MeshRenderer>(); renderer.material = _pinhighlight; Userinput.Add(raycastHit.transform.gameObject); } else if (m_GrabAction.GetStateDown(m_Pose.inputSource) && raycastHit.transform.tag == "PIN" && started && !stopped) { //Debug.Log("HALLOOOOOOOOOOOOO"); selectedPINS.Add(raycastHit.transform.name); passwordmodel.backupInput(raycastHit.transform.name); feedbackElements.Add(new FeedbackModel(raycastHit.collider.gameObject, raycastHit.collider.GetComponent <MeshRenderer>().material, feedbacktime)); MeshRenderer renderer = raycastHit.collider.gameObject.GetComponent <MeshRenderer>(); renderer.material = _pinhighlight; Userinput.Add(raycastHit.transform.gameObject); mdfw.WriteToFileCsv(new DataModel(inputtime, raycastHit.transform.name)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, raycastHit.transform.name)); if (selectedPINS.Count == 4) { mdfw.WriteToFileCsv(new DataModel(inputtime, "status: " + security)); fullmdfw.WriteToFileCsv(new DataModel(fullinputtime, "status: " + security)); mdfw.StopRecording(); fullmdfw.StopRecording(); fw.StopRecording(); fullfw.StopRecording(); } } } } Debug.Log("errors: " + passwordmodel.getErrors()); if (selectedPINS.Count == 4) { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("PIN")) { pin.GetComponent <MeshRenderer>().material = _pinhighlight; } //selectedPINS.Add("empty"); } if (feedbackElements != null) { foreach (FeedbackModel element in feedbackElements.ToArray()) { element.Time -= Time.deltaTime; //Debug.Log("element time" + element.Time); if (element.Time <= 0 && selectedPINS.Count != 4) { element.Gameobject.GetComponent <MeshRenderer>().material = element.Material; feedbackElements.Remove(element); } } } if (trials == 3) { foreach (GameObject pin in GameObject.FindGameObjectsWithTag("PIN")) { pin.GetComponent <MeshRenderer>().enabled = false; } } _gazeTrail.ParticleColor = Color.blue; }