void Update() { if (!calibrationRunning && !breakRunning) { // Only do trial stuff when we are not reorienting the user or collecting responses if (!intermissionRunning) { textController.ChangeQuestionText(null, 0); if (trialStartTime == DateTime.MinValue) { trialStartTime = DateTime.Now; } StartCoroutine(myMovementExperiment.RunTrial()); if (myMovementExperiment.trialInProgress && !myMovementExperiment.isPracticeTrial) { if (!trialStartLogged) { LogTrialData(true); } } else { myMovementExperiment.trialInProgress = true; } } // Trial was finished, now we can begin intermission else if (intermissionRunning) { Debug.Log("Intermission running"); if (!promptShowing) { StartCoroutine(ShowPrompt()); promptShowing = true; } if (Input.GetKeyDown(INITIATE_BREAK)) { breakRunning = true; } } } else if (breakRunning && (lastTrialCompletedCount == completedTrialCount)) { Debug.Log("Experiment paused"); textController.ChangeQuestionText("Experiment paused", 5); textController.ChangeOptionText(new string[] { "" }, 5); if (Input.GetKeyDown(INITIATE_BREAK)) { textController.ChangeQuestionText(null, 0); calibrationRunning = true; intermissionRunning = false; promptShowing = false; CalibrateUser(); breakRunning = false; orientingInProgress = false; if (!calibrationRunning) { myMovementExperiment.ResetPlayerPosition(); textController.ChangeQuestionText(null, 0); } } } }