/*...*/ void Start() { // Get eyetracker smiInstance = SMI.SMIEyeTrackingUnity.Instance; //init of the keybord keyBoardAlpha = GameObject.Find("keyboard_Alpha"); //init of the feedback text under the keyboard Text = GameObject.Find("Satz"); Satz = Text.GetComponent <Text>(); //inti the Wordlayer which displays the words to write WordLayer = GameObject.Find("WordLayer"); WordLayer.SetActive(false); Word = WordLayer.transform.GetChild(0).GetComponent <Text> (); //save all Layers in an Array Layers = new GameObject[keyBoardAlpha.transform.childCount]; //saves all Letters in an Array AllLetter = new GameObject[32]; //fency Soundclip to show the end of the Worddisplaytime AudioSource.clip = SoundClip; //init words of Session 1 the trainingssession Word1 = new string[] { "D", "A", "S", "S" }; Word2 = new string[] { "P", "R", "A", "L", "L" }; Word3 = new string[] { "V", "O", "M" }; Word4 = new string[] { "W", "H", "I", "S", "K", "Y" }; Word5 = new string[] { "F", "L", "O", "G" }; Word6 = new string[] { "X", "Y", "Z" }; Word7 = new string[] { "Q", "U", "A", "X" }; Word8 = new string[] { "D", "E", "N" }; Word9 = new string[] { "J", "E", "T" }; Word10 = new string[] { "Z", "U" }; Word11 = new string[] { "B", "R", "U", "C", "H" }; Word12 = new string[] { "J", "E", "D", "E", "R" }; Word13 = new string[] { "B", "A", "Y", "E", "R" }; Word14 = new string[] { "W", "A", "C", "K", "E", "R", "E" }; Word15 = new string[] { "V", "E", "R", "T", "I", "L", "G", "T" }; Word16 = new string[] { "B", "E", "Q", "U", "E", "M" }; Word17 = new string[] { "Z", "W", "O" }; Word18 = new string[] { "K", "A", "L", "B", "S", "H", "A", "X", "E" }; Session1 = new string[] { string.Join("", Word1), string.Join("", Word2), string.Join("", Word3), string.Join("", Word4), string.Join("", Word5), string.Join("", Word6), string.Join("", Word7), string.Join("", Word8), string.Join("", Word9), string.Join("", Word10), string.Join("", Word11), string.Join("", Word12), string.Join("", Word13), string.Join("", Word14), string.Join("", Word15), string.Join("", Word16), string.Join("", Word17), string.Join("", Word18) }; //randomize the order of Words in the Sessions Session1.ListShuffle <string> (); //Initialisation of all important Eye and Letter data EyeSpeed = new float[32]; EyePosX = new float[32]; EyePosY = new float[32]; EyeDirVec = new Vector2 [32]; Letterspeed = new float [32]; LetterPosX = new float[32]; LetterPosY = new float[32]; LetterDirVec = new Vector2 [32]; LetterName = new string[32]; Layerspeed = new float [4]; LayerPosX = new float[4]; LayerPosY = new float[4]; LayerDirVec = new Vector2 [4]; LayerName = new string[4]; AngelDirLetterDirEye = new float[32]; DistLetterEyePOR = new float [32]; SpeedDivision = new float[32]; AngleCameraLetter = new float[32]; LeftGazeDirAngleCameraLetter = new float[32]; RightGazeDirAngleCameraLetter = new float[32]; NormDirWinkel = new float [32]; MatchValue = new float[32]; MatchValueGewichtet = new float [32]; MatchValueGewichtet2 = new float [32]; MatchCounter = new float [32]; MatchCounterWhole = new float[32]; MatchCounterAfterLayer = new float[32]; MatchCounterAfterLayerGewi2 = new float[32]; MatchCounterGewichtet = new float [32]; MatchCounterGewichtet2 = new float [32]; LayerMatchValueGewichtet = new float [4]; LayerCounter = new float[4]; LayerCounterGewichtet = new float[4]; Letters = new GameObject[8]; //Init Logger für Augendaten EyeLogger.getInstance().initLogger(participantNumber); EyeLogger.getInstance().log("timestamp", "ParticipantNumber", "Name", "ObjPosX", "ObjPosY", "EyePosX ", "EyePosY", "DistObjEyePOR", "Objspeed", " EyeSpeed", "SpeedDivision ", "ObjDirVec", "EyeDirVec", "normierDirectionAngle", "AngleCameraObj", "LeftGazeDirAngleObj", "RightGazeDirAngleObj", "MatchValue", "MatchValueGewichtet", "LetterMatchCounter", "LetterMatchCounterGewichtet", "LayerCunterGewichtet", "MatchCounterWhole", "durchgang", "MatchValueGewichtet2", "MatchCounterGewichtet2", "MatchCounterAfterLayerSelect", "MatchCounterAfterLayerSelectGewi2"); //Init Logger für Studiendaten WritingLogger.getInstance().initLogger(participantNumber); WritingLogger.getInstance().log("timestamp", "ParticipantNumber", "maxLayertime", " maxtime ", "SessionNr", "StepNumber", "WantedKey", "PressedKey", "CorrectKeyPressed", "TimeBetweenLetterAnimationAndItsSelection", "TimeBetweenSelections", "TimeBetweenLastLetterSelectedAndNewOne", "NumberOfRound", "SelectedKeyGewi2", "CorrectKeyGewi", "SelectedKeyAfterLayerSelected", "correctKeyAfterLayer", "SelectedKeyAfterLayerGewi2", "correctKeyAfterLayerGewi2"); //Write all Letters in an Array AllLetter[i], i = [0...31] by saving the children of the Layer [j] , j =[0...3] for (int j = 0; j < keyBoardAlpha.transform.childCount; j++) { if (keyBoardAlpha.transform.GetChild(j).transform.tag == "Layers") { Layers [j] = keyBoardAlpha.transform.GetChild(j).transform.gameObject; keyboardKeys = new GameObject[Layers [j].transform.childCount]; for (int i = 0; i < Layers [j].transform.childCount; i++) { if (Layers [j].transform.GetChild(i).transform.tag == "KeyboardKey") { keyboardKeys [i] = Layers [j].transform.GetChild(i).transform.gameObject; AllLetter[lettercount] = keyboardKeys[i]; lettercount++; } } } } }
/*...*/ //This function checks which session is active and set all values which are necessary for the current Session like maxtime until a Letter is selected //saves the current Session and increments the Wordstep counter //Show up the Word on the Layer which presents the next Word to write and test which word is the actual one for further calculations public void nextSession() { if (SessionStep <= 0) { Debug.Log("Session not started yet"); } else if (SessionStep == 1) { WritingLogger.getInstance().log("Session 1 Started"); currentSession = Session1; setMaxTime(1.2f); setMaxLayerTime(0.8f); //Wordstep became 1 WordStep++; setWordToLayer(Session1[WordStep - 1]); testActualWord(WordStep); Debug.Log("You Are in Session1"); //increments the Session step after all important calculations SessionStep++; } else if (SessionStep == 2) { WritingLogger.getInstance().log("Session 2 Started"); currentSession = Session2; setMaxTime(1.0f); setMaxLayerTime(0.66f); WordStep++; setWordToLayer(Session2[WordStep - 1]); testActualWord(WordStep); Debug.Log("You Are in Session2"); SessionStep++; } else if (SessionStep == 3) { WritingLogger.getInstance().log("Session 3 Started"); currentSession = Session3; setMaxTime(0.8f); setMaxLayerTime(0.6f); WordStep++; setWordToLayer(Session3[WordStep - 1]); testActualWord(WordStep); Debug.Log("You Are in Session3"); SessionStep++; } else if (SessionStep == 4) { WritingLogger.getInstance().log("Session 4 Started"); currentSession = Session4; setMaxTime(0.6f); setMaxLayerTime(0.5f); WordStep++; setWordToLayer(Session4[WordStep - 1]); testActualWord(WordStep); Debug.Log("You Are in Session4"); SessionStep++; } else if (SessionStep == 5) { WritingLogger.getInstance().log("Session 5 Started"); currentSession = Session5; setMaxTime(0.4f); setMaxLayerTime(0.35f); WordStep++; setWordToLayer(Session5[WordStep - 1]); testActualWord(WordStep); Debug.Log("You Are in Session5"); SessionStep++; } else if (SessionStep == 6) { WritingLogger.getInstance().log("Session 6 Started"); currentSession = Session6; setMaxTime(0.3f); setMaxLayerTime(0.28f); WordStep++; setWordToLayer(Session6[WordStep - 1]); testActualWord(WordStep); Debug.Log("You Are in Session6"); SessionStep++; } else { //if session number is 7 or greater then the study is over and all Counters and Stats where set to default = 0; StudyIsRunning = false; SessionStep = 0; currentStep = 0; WordStep = 0; setWordToLayer("Danke für die Teilnahme"); Debug.Log("Study is done"); } }