private bool Trigger_Last_State = false; // When the trigger is pressed, Trigger_Last_State is "true" otherwise "false" void Start() { Trigger_Data.AddOnStateDownListener(TriggerDown, handType); Trigger_Data.AddOnStateUpListener(TriggerUp, handType); Trigger_Marker = FindObjectOfType <LSLMarkerStream>(); }
void Start() { marker = FindObjectOfType <LSLMarkerStream>(); resolution = Screen.resolutions; refreshRate = resolution[3].refreshRate; }
// Start is called before the first frame update void Start() { //Get the screen refresh rate, so that the colours can be set appropriately resol = Screen.resolutions; refreshRate = resol[3].refreshRate; //Set up LSL Marker Stream marker = FindObjectOfType <LSLMarkerStream>(); //Setting up Keys, to lock other keys when one simulation is being run keyLocks.Add(KeyCode.R, false); keyLocks.Add(KeyCode.S, false); keyLocks.Add(KeyCode.D, false); locked_keys = false; //Check to see if inputs are valid, if not, then don't draw matrix and prompt user to redraw with the //correct inputs if (CheckEmpty()) { print("Values must be non-zero and non-negative, please re-enter values and press 'D' to redraw..."); locked_keys = true; return; } //Initialize Matrix SetUpMatrix(); SetUpSingle(); SetUpRC(); SaveCurrentInfo(); //Set the colour of the box to the given offColour TurnOff(); System.Threading.Thread.Sleep(2000); SendInfo(); }
// Start is called before the first frame update void Start() { sM = marker.GetComponent <LSLMarkerStream>(); m = Manager.GetComponent <Manager>(); insideSquareScript = startSquare.GetComponent <StartSquare>(); selectionSquareArousal.SetActive(false); selectionSquareValence.SetActive(false); selectionSquareDominance.SetActive(false); //Setting all SAM's off Arousal.SetActive(false); Valence.SetActive(false); Dominance.SetActive(false); //Get all SAM's Arousal A0 = Arousal.transform.GetChild(0).gameObject; A1 = Arousal.transform.GetChild(1).gameObject; A2 = Arousal.transform.GetChild(2).gameObject; A3 = Arousal.transform.GetChild(3).gameObject; A4 = Arousal.transform.GetChild(4).gameObject; //Get all SAM's Valence V0 = Valence.transform.GetChild(0).gameObject; V1 = Valence.transform.GetChild(1).gameObject; V2 = Valence.transform.GetChild(2).gameObject; V3 = Valence.transform.GetChild(3).gameObject; V4 = Valence.transform.GetChild(4).gameObject; //Get all SAM's Dominance D0 = Dominance.transform.GetChild(0).gameObject; D1 = Dominance.transform.GetChild(1).gameObject; D2 = Dominance.transform.GetChild(2).gameObject; D3 = Dominance.transform.GetChild(3).gameObject; D4 = Dominance.transform.GetChild(4).gameObject; }
// update variable updateTimeStamp using object.Update(), then return updated time using double fun // UpdateTimeStamp void Start() { t = FindObjectOfType <LSLTimeSync>(); t.Update(); time_start = t.UpdateTimeStamp; print(time_start); marker = FindObjectOfType <LSLMarkerStream>(); // stream opens so labrecorder can listen listener = new TcpListener(IPAddress.Parse("127.0.0.1"), 55001); listener.Start(); print("is listening"); }
// Start is called before the first frame update void Start() { //Getting LSL stream marker = FindObjectOfType <LSLMarkerStream>(); //Generating pseudo-randomized trial list for (int i = 0; i < (TotalNumberTrials / 3); i++) { DoorCaseList.Add(1); DoorCaseList.Add(2); DoorCaseList.Add(3); DoorCaseList = DoorCaseList.OrderBy(x => UnityEngine.Random.value).ToList(); } //Generating pseudo-randomized GoNoGo list for (int i = 0; i < (TotalNumberTrials / 2); i++) { GoNoGoList.Add("Go"); GoNoGoList.Add("NoGo"); GoNoGoList = GoNoGoList.OrderBy(x => UnityEngine.Random.value).ToList(); } //Generating randomized list of time in dark System.Random rnd = new System.Random(); for (int i = 0; i < TotalNumberTrials; i++) { TimeInDarkList.Add(rnd.Next(TimeInDark - DarkSD, TimeInDark + DarkSD)); } //Generating randomized list of time in dark for (int i = 0; i < TotalNumberTrials; i++) { TimeToImperativeList.Add(rnd.Next(TimeToImperative - LightSD, TimeToImperative + LightSD)); } //Removing the cursor in-game Cursor.visible = false; //Setting start status isDark = true; DarkTimer = TimeInDarkList[CurrentTrial]; LightTimer = TimeToImperativeList[CurrentTrial]; GoNoGoState = ""; //Retrieving the SAM questionnaire SAMcode = gameobjectSAM.GetComponent <SAM>(); }
// Update is called once per frame void Update() { //Row/Column Flash P300 //Conditional to check key locks if (Input.GetKeyDown(KeyCode.R) && keyLocks[KeyCode.S] == false && keyLocks[KeyCode.D] == false && !locked_keys) { keyLocks[KeyCode.R] = !keyLocks[KeyCode.R]; startFlashes = !startFlashes; if (startFlashes) { print("Starting P300 RCFlash"); marker.Write("P300 RCFlash Begins"); SetUpRC(); StartCoroutine("RCFlash"); } else { // Selected if the user pauses the simulation before it is complete print("Stopping P300 RCFlash"); marker.Write("P300 RCFlash Ends"); StopCoroutine("RCFlash"); ResetCounters(); print("Counters Reset! Hit G again to run P300 RCFlash"); } } //Single Flash P300 //Conditional to check key locks if (Input.GetKeyDown(KeyCode.S) && keyLocks[KeyCode.R] == false && keyLocks[KeyCode.D] == false && !locked_keys) { keyLocks[KeyCode.S] = !keyLocks[KeyCode.S]; startFlashes = !startFlashes; if (startFlashes) { print("Starting P300 SingleFlash"); //Writing to LSL to signal start of simulation marker.Write("P300 SingleFlash Begins"); SetUpSingle(); StartCoroutine("SingleFlash"); } else { // Selected if the user pauses the simulation before it is complete print("Stopping P300 SingleFlash"); //Writing to LSL to signal end of simulation marker.Write("P300 SingleFlash Ends"); StopCoroutine("SingleFlash"); ResetCounters(); print("Counters Reset! Hit S again to run P300 SingleFlash"); } } //Redraw Matrix //Select this after changing parameters if (Input.GetKeyDown(KeyCode.D) && keyLocks[KeyCode.R] == false && keyLocks[KeyCode.S] == false) { //Check if values are empty if (CheckEmpty()) { print("Values must be non-zero and non-negative, please re-enter values and try again..."); locked_keys = true; return; } keyLocks[KeyCode.D] = true; print("Redrawing Matrix"); TurnOff(); DestroyMatrix(); ResetCounters(); cube_list.Clear(); SetUpMatrix(); SetUpSingle(); SetUpRC(); TurnOff(); keyLocks[KeyCode.D] = false; locked_keys = false; } //Quit Program if (Input.GetKeyDown(KeyCode.Q)) { print("Quitting Program..."); marker.Write("Quit"); marker = null; Application.Quit(); } }
// Start is called before the first frame update void Start() { //Get the screen refresh rate, so that the colours can be set appropriately resol = Screen.resolutions; refreshRate = resol[3].refreshRate; //Set up LSL Marker Stream marker = FindObjectOfType <LSLMarkerStream>(); //Setting up Keys, to lock other keys when one simulation is being run keyLocks.Add(KeyCode.R, false); keyLocks.Add(KeyCode.S, false); //keyLocks.Add(KeyCode.D, false); //Removing Key 'D' since redraw matrix is meant for dynamically created matrices locked_keys = false; /* Speech Recognizer Variables */ keywords.Add("Start Flash", () => { //Copied code from SingleFlash keyLocks[KeyCode.S] = !keyLocks[KeyCode.S]; startFlashes = !startFlashes; if (startFlashes) { print("Starting P300 SingleFlash"); //Writing to LSL to signal start of simulation marker.Write("P300 SingleFlash Begins"); SetUpSingle(); StartCoroutine("SingleFlash"); } else { // Selected if the user pauses the simulation before it is complete print("Stopping P300 SingleFlash"); //Writing to LSL to signal end of simulation marker.Write("P300 SingleFlash Ends"); StopCoroutine("SingleFlash"); ResetCounters(); print("Counters Reset! Hit S again to run P300 SingleFlash"); } }); // Tell the KeywordRecognizer about our keywords keywordRecognizer = new KeywordRecognizer(keywords.Keys.ToArray()); //Register a callback for the KeywordRecognizer and start recognizing keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized; keywordRecognizer.Start(); /* Unused Functionality, since cube matrix is not being created dynamically, there are no matrix reconfigurations to be made */ //Check to see if inputs are valid, if not, then don't draw matrix and prompt user to redraw with the //correct inputs // if(CheckEmpty()){ // print("Values must be non-zero and non-negative, please re-enter values and press 'D' to redraw..."); // locked_keys = true; // return; // } //Initialize Matrix HUD_Setup(); //Function specific to this program //SetUpMatrix(); SetUpSingle(); SetUpRC(); // SaveCurrentInfo(); //Set the colour of the box to the given offColour TurnOff(); System.Threading.Thread.Sleep(2000); SendInfo(); /* Testing purposes */ startFlashes = !startFlashes; keyLocks[KeyCode.S] = !keyLocks[KeyCode.S]; print("Starting P300 SingleFlash"); marker.Write("P300 SingleFlash Begins"); SetUpSingle(); StartCoroutine("SingleFlash"); }
// Use this for initialization void Start() { NormalConflictArr = new int[nrOfTrials]; if (vibroFeedbackCondition) { feedback_type = "vibro"; } else if (emsFeedbackCondition) { feedback_type = "ems"; } else { feedback_type = "visual"; } // init LSL markerstream marker = FindObjectOfType <LSLMarkerStream>(); // init arduino arduino = Arduino.global; arduino.Setup(ConfigurePins); // Finding the game object table = GameObject.Find("Table"); plane = GameObject.Find("Plane"); leapmotion = GameObject.Find("LeapHandController"); instruct = GameObject.Find("IntroGUI"); textBox = GameObject.Find("TextBox"); endexp = GameObject.Find("End"); startPos = GameObject.Find("startPosDisc"); resting = GameObject.Find("resting"); questionnaire = GameObject.Find("questionnaire"); q = GameObject.Find("question"); ra = GameObject.Find("right_anchor"); la = GameObject.Find("left_anchor"); send = GameObject.Find("send"); // rehastim interface rehastim = GameObject.Find("RehaStim"); // For Big Cube cubeLeft = GameObject.Find("CubeLeft"); cubeMiddle = GameObject.Find("CubeMiddle"); cubeRight = GameObject.Find("CubeRight"); // Assign game objects to arrays cubeGameObjArr[0] = cubeLeft; cubeGameObjArr[1] = cubeMiddle; cubeGameObjArr[2] = cubeRight; // Randomize Cube Appearance Sequence RandomizeArray.ShuffleArray(CubeSeq); // Trial definition error with 1s and 0s for either conflict or normal trial depending on volatility of simulation if (!training) { NormalConflictArr = RandomizeArray.GenerateArraySequences(nrOfTrials, 0.1, 5); } // todo fix GenerateArraySequence function so volatility param works // if (volatility == 1) // { // NormalConflictArr = RandomizeArray.GenerateArraySequences(nrOfTrials, 0.1, 5); // } // else if (volatility == 0) // { // NormalConflictArr = RandomizeArray.GenerateArraySequences(nrOfTrials, 0.1, 5); // } // instruct and leapmotion game object remain visible and only table, plane and the end instruction are made invisible table.gameObject.GetComponent <Renderer>().enabled = false; plane.gameObject.GetComponent <Renderer>().enabled = false; instruct.gameObject.gameObject.GetComponent <Canvas>().enabled = true; endexp.gameObject.gameObject.GetComponent <Canvas>().enabled = false; resting.gameObject.GetComponent <Renderer>().enabled = false; questionnaire.SetActive(false); // hide startPosDisc startPos.SetActive(false); DisableAllCube(); // set color to white, disable renderer and sphereCollider }
// Start is called before the first frame update void Start() { marker = FindObjectOfType <LSLMarkerStream>(); markerIndex = 0; //InvokeRepeating("sendMarker", 0f, secondsBetweenMarkers); }