void IteratorUpdate() { iterator++; if (iterator >= SIZE) { BlockIterator++; if (BlockIterator >= BLOCK_SIZE) { //end experiment screen Debug.Log("END EXPERIMENT!"); Output.Close(); Application.Quit(); } else { //end block screen Pause = true; isPaused.text = "Paused = True"; if (blockList[BlockIterator].ChairSetups.Length > blockList[BlockIterator].BallSetups.Length) { SIZE = blockList[BlockIterator].ChairSetups.Length; } else { SIZE = blockList[BlockIterator].BallSetups.Length; } iterator = 0; TxtBlock.text = "Block Set: " + BlockIterator.ToString(); } } Trial.text = "Trial Number: " + iterator.ToString(); }
void RecordTrial() { if (Output == null) { Output = File.CreateText(FilePath); Output.WriteLine(FilePath); Output.WriteLine("Subject ID: " + SettingsSingleton.instance.ParticipantID); Output.WriteLine("\nChair type, 0 = empty chair, 1 = avatar"); Output.WriteLine("Negative Ball Rotation, is a ball on the left\n"); Output.WriteLine("Block Number,Trial Number,Chair Type,Chair Rotation,Ball Distance,Ball Rotation,Input,Response Time, Was Correct, Distance From Table"); Debug.Log("Output was null, attempted file creation"); return; } float mathStuff = Mathf.Abs(playerCam.transform.position.z) - Mathf.Abs(Table.transform.localScale.x / 2); bool wasCorrect; string WCString; if ((blockList[BlockIterator].BallSetups[iterator][1] > 0 && InputRecorder == "Right") || (blockList[BlockIterator].BallSetups[iterator][1] < 0 && InputRecorder == "Left")) { wasCorrect = true; WCString = "True"; } else if (InputRecorder != "Left" && InputRecorder != "Right") { wasCorrect = false; WCString = ""; } else { wasCorrect = false; WCString = "False"; } string WriteMe = BlockIterator.ToString() + ',' + iterator.ToString() + ',' + blockList[BlockIterator].ChairSetups[iterator][0].ToString() + ',' + blockList[BlockIterator].ChairSetups[iterator][1].ToString() + ',' + blockList[BlockIterator].BallSetups[iterator][0].ToString() + ',' + blockList[BlockIterator].BallSetups[iterator][1].ToString() + ',' + InputRecorder.ToString() + ',' + ResponseTime.ToString() + ',' + WCString + ',' + mathStuff; Output.WriteLine(WriteMe); }
// Use this for initialization void Start() { //set forcedHeight ForcedHeightAdjustment = SettingsSingleton.instance.Cal_H / 100; fixationCross.transform.position = new Vector3(0, (SettingsSingleton.instance.EyeHeight / 100) + .06f, 0); float Yscale = 0; //set avatar display if (SettingsSingleton.instance.isFemale) { Destroy(MaleAva); Yscale = (FemAva.transform.localScale.y) + (.1f * (SettingsSingleton.instance.EyeHeight / 100 - 1.5f)); FemAva.transform.localScale = new Vector3(FemAva.transform.localScale.x, Yscale, FemAva.transform.localScale.z); } else { Destroy(FemAva); Yscale = (FemAva.transform.localScale.y) + (.1f * (SettingsSingleton.instance.EyeHeight / 100 - 1.2f)); MaleAva.transform.localScale = new Vector3(MaleAva.transform.localScale.x, Yscale, MaleAva.transform.localScale.z); } ReadINI(); if (ForcePlayerPosition) { player.transform.position = new Vector3(Player_Chair.transform.position.x, ForcedHeightAdjustment, Player_Chair.transform.position.z); } if (blockList[BlockIterator].ChairSetups.Length > blockList[BlockIterator].BallSetups.Length) { SIZE = blockList[BlockIterator].ChairSetups.Length; } else { SIZE = blockList[BlockIterator].BallSetups.Length; } BLOCK_SIZE = blockList.Length; // Set files paths string temp = System.DateTime.Now.ToString(); temp = temp.Replace("/", "_").Replace(":", "-"); FilePath = "Subject_" + SettingsSingleton.instance.ParticipantID + "_" + FilePath + "_" + temp + ".csv"; TrialListingFile = "Subject_" + SettingsSingleton.instance.ParticipantID + "_" + TrialListingFile + "_" + temp + ".csv"; RecordTrial(); WriteTrialList(); //initialize variables for later use ResponseTime = 0; TrialTimer = 0; Pause = true; isPaused.text = "Paused = True"; TxtBlock.text = "Block Set: " + BlockIterator.ToString(); Trial.text = "Trial Number: " + iterator.ToString(); Chair_Table_Distance = Player_Chair.transform.position.z - (Table.transform.localScale.x / 2); RunningTrial = false; //set table location //set player chair location Player_Chair.transform.RotateAround(Table.transform.position, Vector3.up, 0); Player_Chair.transform.LookAt(new Vector3(Table.transform.position.x, Player_Chair.transform.position.y, Table.transform.position.z)); }