void Update() { //increment elapsedTime for Timeout elapsedTime += Time.deltaTime; //save position data if (gameController.fs != null) { if (trigger) { // send parallel port if (GameController.instance.parallelPortAddr != -1) { ParallelPort.TryOut32(GameController.instance.parallelPortAddr, triggerValue); ParallelPort.TryOut32(GameController.instance.parallelPortAddr, 0); } gameController.fs.WriteLine("{0} {1:F8} {2:F2} {3:F2} {4:F2}", triggerValue, Time.deltaTime, robot.transform.position.x, robot.transform.position.z, robot.transform.eulerAngles.y); trigger = false; } else { gameController.fs.WriteLine(" {0:F8} {1:F2} {2:F2} {3:F2}", Time.deltaTime, robot.transform.position.x, robot.transform.position.z, robot.transform.eulerAngles.y); } } }
void Update() { //increment elapsedTime for Timeout elapsedTime += Time.deltaTime; //determine if trail complete float angle = Vector3.Angle(robot.transform.forward, startWaypoint.forward); angle = Mathf.Abs(angle); if ((angle > 70) && inTrial) { inTrial = false; CompleteTrial(); } //save position data if (gameController.fs != null) { if (trigger) { // send parallel port Debug.Log(triggerValue); if (GameController.instance.parallelPortAddr != -1) { ParallelPort.TryOut32(GameController.instance.parallelPortAddr, triggerValue); ParallelPort.TryOut32(GameController.instance.parallelPortAddr, 0); } gameController.fs.WriteLine("{0} {1:F8} {2:F2} {3:F2} {4:F2} {5:F2} {6:F2}", triggerValue, Time.deltaTime, robot.transform.position.x, robot.transform.position.z, robot.transform.eulerAngles.y); trigger = false; } else { gameController.fs.WriteLine(" {0:F8} {1:F2} {2:F2} {3:F2} {4:F2} {5:F2} ", Time.deltaTime, robot.transform.position.x, robot.transform.position.z, robot.transform.eulerAngles.y); } } }
public void OnParallelTestClick() { try{ int addr = int.Parse(parallelPortField.text, System.Globalization.NumberStyles.HexNumber); if (parallelflip) { ParallelPort.TryOut32(addr, 255); } else { ParallelPort.TryOut32(addr, 0); } parallelflip = !parallelflip; parallelPortField.image.color = Color.green; } catch (System.Exception e) { experimentStatus = e.ToString(); parallelPortField.image.color = Color.red; } }
void Update() { //increment elapsedTime for Timeout elapsedTime += Time.deltaTime; //save position data if (gameController.fs != null) { string timeNow = DateTime.Now.ToString("hhmmss.FFF"); if (trigger) { int EL = TryGetEyelinkConnectedStatus(); Debug.Log("EL:" + EL); if (EL == 2) { if (triggerValue < 20) { TryEyemsg_Printf("Start Trial " + triggerValue); //Debug.Log(current_time()); } else if (triggerValue > 20 && triggerValue < 30) { TryEyemsg_Printf("Cue Offset " + triggerValue); } else if (triggerValue > 30 && triggerValue < 40) { TryEyemsg_Printf("End Trial " + triggerValue); //close_eyelink_connection(); } else if (triggerValue > 40 && triggerValue < 50) { TryEyemsg_Printf("Timeout " + triggerValue); //close_eyelink_connection(); } else if (triggerValue > 80) { TryEyemsg_Printf("Trigger Version " + triggerValue); //close_eyelink_connection(); } } ParallelPort.TryOut32(GameController.instance.parallelPortAddr, triggerValue); // uncomment lines (124 and 139) to send triggers to Ripple // send parallel port //if (GameController.instance.parallelPortAddr != -1) { // ParallelPort.Out32 (GameController.instance.parallelPortAddr, triggerValue); // ParallelPort.Out32 (GameController.instance.parallelPortAddr, 0); //} gameController.fs.WriteLine(" {0} {1:F8} {2:F4} {3:F4} {4:F4}", triggerValue, Time.deltaTime, robot.transform.position.x, robot.transform.position.z, robot.transform.eulerAngles.y); trigger = false; ParallelPort.TryOut32(GameController.instance.parallelPortAddr, 0); // clear parallel port } else { gameController.fs.WriteLine(" {0} {1:F8} {2:F4} {3:F4} {4:F4}", 0, Time.deltaTime, robot.transform.position.x, robot.transform.position.z, robot.transform.eulerAngles.y); } } if (showcue1) { var clone = Instantiate(cues[thisTarget], robot.transform.position + robot.transform.forward * 0.5f + robot.transform.up * 1.2f, robot.transform.rotation); // present cue (indicate location in space) clone.transform.localScale = new Vector3(0.5f, 0.3f, 0.005f); // size of central cue Destroy(clone, 0.02f); // remove cue at update rate so that cue appears to follow camera } if (showcue2) { var clone = Instantiate(cues[thisTarget], robot.transform.position + robot.transform.forward * 0.5f + robot.transform.up * 1.46f, robot.transform.rotation); // present cue (indicate location in space) clone.transform.localScale = new Vector3(0.1f, 0.06f, 0.005f); // size of peripheral cue Destroy(clone, 0.02f); // remove cue at update rate so that cue appears to follow camera } }