/// <summary> /// Returns the color of the assigned text elements to whatever they were when this monobehavior initialized (usually scene load). /// </summary> public void OriginalColor() { for (int i = 0; i < textElements.Length; i++) { textElements[i].color = originalColors[i]; } if (wordEventReporter != null) { wordEventReporter.ReportScriptedEvent("restore original text color", new Dictionary <string, object>()); } }
private IEnumerator DisplayMessage(GameObject message) { Dictionary <string, object> messageData = new Dictionary <string, object>(); messageData.Add("message name", message.name); scriptedEventReporter.ReportScriptedEvent("instruction message displayed", messageData); message.SetActive(true); yield return(null); while (!Input.GetButtonDown("x (continue)")) { yield return(null); } scriptedEventReporter.ReportScriptedEvent("instruction message cleared", messageData); message.SetActive(false); }
private void ReportMessage(string message, bool sent) { Dictionary <string, object> messageDataDict = new Dictionary <string, object>(); messageDataDict.Add("message", message); messageDataDict.Add("sent", sent.ToString()); scriptedEventReporter.ReportScriptedEvent("network", messageDataDict); }
public IEnumerator DoFamiliarization(float minISI, float maxISI, float presentationLength) { yield return(new WaitForSeconds(Random.Range(minISI, maxISI))); for (int i = 0; i < stores.Length; i++) { Dictionary <string, object> displayData = new Dictionary <string, object>(); displayData.Add("store name", deliveryExperiment.GetStoreNameFromGameObjectName(stores[i].name)); scriptedEventReporter.ReportScriptedEvent("familiarization store displayed", displayData); stores[i].SetActive(true); yield return(new WaitForSeconds(presentationLength)); scriptedEventReporter.ReportScriptedEvent("familiarization store cleared", displayData); stores[i].SetActive(false); yield return(new WaitForSeconds(Random.Range(minISI, maxISI))); } }
void Update() { if (allowPausing && Input.GetKeyDown(KeyCode.P) && !paused) { pauseScreen.SetActive(true); playerMovement.Freeze(); paused = true; scriptedEventReporter.ReportScriptedEvent("pause", new Dictionary <string, object>()); } else if (allowPausing && Input.GetKeyDown(KeyCode.P) && paused) { pauseScreen.SetActive(false); playerMovement.Unfreeze(); paused = false; scriptedEventReporter.ReportScriptedEvent("unpause", new Dictionary <string, object>()); } }
void Pulse() { System.Random random = new System.Random(); //delay before starting pulses Thread.Sleep((int)(PULSE_START_DELAY * SECONDS_TO_MILLISECONDS)); while (true) { //pulse reporter.ReportScriptedEvent("Sync pulse begin", new System.Collections.Generic.Dictionary <string, object>()); SyncPulse(); reporter.ReportScriptedEvent("Sync pulse end", new System.Collections.Generic.Dictionary <string, object>()); //wait a random time between min and max float timeBetweenPulses = (float)(TIME_BETWEEN_PULSES_MIN + (random.NextDouble() * (TIME_BETWEEN_PULSES_MAX - TIME_BETWEEN_PULSES_MIN))); Thread.Sleep((int)(timeBetweenPulses * SECONDS_TO_MILLISECONDS)); } }
void Awake() { Cursor.visible = false; Application.runInBackground = true; if (settings.Equals(default(ExperimentSettings))) { throw new UnityException("Please call ConfigureExperiment before loading the experiment scene."); } //write versions to logfile Dictionary <string, object> versionsData = new Dictionary <string, object>(); versionsData.Add("UnityEPL version", Application.version); versionsData.Add("Experiment version", settings.version); versionsData.Add("Logfile version", "1"); scriptedEventReporter.ReportScriptedEvent("versions", versionsData); //textDisplayer.DisplayText("display end message", "Woo! The experiment is over."); }
/// <summary> /// Returns the color of the assigned text elements to whatever they were when this monobehavior initialized (usually scene load). /// </summary> public void OriginalColor() { textElement.color = originalColors[0]; titleElement.color = originalColors[1]; if (wordEventReporter != null) { wordEventReporter.ReportScriptedEvent("restore original text color", new Dictionary <string, object>()); } }
private void Pulse() { if (!stopped) { Debug.Log("Pew!"); // Send a pulse if (scriptedInput != null) { scriptedInput.ReportScriptedEvent("syncPulse", new System.Collections.Generic.Dictionary <string, object>()); } SyncPulse(); // Wait a random interval between min and max int timeBetweenPulses = (int)(TIME_BETWEEN_PULSES_MIN + (int)(rnd.NextDouble() * (TIME_BETWEEN_PULSES_MAX - TIME_BETWEEN_PULSES_MIN))); DoIn(new EventBase(Pulse), timeBetweenPulses); } }
private void LogPulse() { scriptedEventReporter.ReportScriptedEvent("Sync pulse begin", new System.Collections.Generic.Dictionary <string, object>()); }
public override void ReportEvent(string type, Dictionary <string, object> data, DateTime time) { // TODO: time stamps scriptedInput.ReportScriptedEvent(type, data, time); }
private IEnumerator ExperimentCoroutine() { if (sessionNumber == -1) { throw new UnityException("Please call ConfigureExperiment before beginning the experiment."); } //write versions to logfile LogVersions(); if (useRamulator) { yield return(ramulatorInterface.BeginNewSession(sessionNumber)); } BlackScreen(); yield return(DoIntroductionVideo(LanguageSource.GetLanguageString("play movie"), LanguageSource.GetLanguageString("first day"))); yield return(DoSubjectSessionQuitPrompt(sessionNumber, LanguageSource.GetLanguageString("running participant"))); yield return(DoMicrophoneTest(LanguageSource.GetLanguageString("microphone test"), LanguageSource.GetLanguageString("after the beep"), LanguageSource.GetLanguageString("recording"), LanguageSource.GetLanguageString("playing"), LanguageSource.GetLanguageString("recording confirmation"))); yield return(DoFamiliarization()); yield return(messageImageDisplayer.DisplayLanguageMessage(messageImageDisplayer.delivery_restart_messages)); Environment environment = EnableEnvironment(); Dictionary <string, object> storeMappings = new Dictionary <string, object>(); foreach (StoreComponent store in environment.stores) { storeMappings.Add(store.GetStoreName(), store.gameObject.name); storeMappings.Add(store.GetStoreName() + " position X", store.transform.position.x); storeMappings.Add(store.GetStoreName() + " position Y", store.transform.position.y); storeMappings.Add(store.GetStoreName() + " position Z", store.transform.position.z); } scriptedEventReporter.ReportScriptedEvent("store mappings", storeMappings); int trial_number = 0; for (trial_number = 0; trial_number < 12; trial_number++) { Dictionary <string, object> trialData = new Dictionary <string, object>(); trialData.Add("trial number", trial_number); scriptedEventReporter.ReportScriptedEvent("begin new trial", trialData); WorldScreen(); if (useRamulator) { ramulatorInterface.BeginNewTrial(trial_number); } yield return(null); yield return(DoDelivery(environment, trial_number)); BlackScreen(); yield return(DoRecall(trial_number)); SetRamulatorState("WAITING", true, new Dictionary <string, object>()); yield return(null); if (!DeliveryItems.ItemsExhausted()) { textDisplayer.DisplayText("proceed to next day prompt", LanguageSource.GetLanguageString("next day")); while (!Input.GetButton("q (secret)") && !Input.GetButton("x (continue)")) { yield return(null); } textDisplayer.ClearText(); if (Input.GetButton("q (secret)")) { break; } } else { yield return(PressAnyKey(LanguageSource.GetLanguageString("final recall"))); break; } SetRamulatorState("WAITING", false, new Dictionary <string, object>()); } yield return(messageImageDisplayer.DisplayLanguageMessage(messageImageDisplayer.final_recall_messages)); yield return(DoFinalRecall(environment)); //int delivered_objects = trial_number == 12 ? (trial_number) * 12 : (trial_number + 1) * 12; textDisplayer.DisplayText("end text", LanguageSource.GetLanguageString("end message") + starSystem.CumulativeRating().ToString("+#.##;-#.##")); }
private IEnumerator RunExperiment() { textDisplayer.DisplayText("subject name prompt", "Please enter the subject name and then press enter."); yield return(new WaitForSeconds(3f)); textDisplayer.ClearText(); inputField.gameObject.SetActive(true); inputField.Select(); do { yield return(null); while (!Input.GetKeyDown(KeyCode.Return)) { yield return(null); } }while (!inputField.text.Equals("TEST") && (inputField.text.Length != 7 || !inputField.text[0].Equals('P') || !inputField.text[1].Equals('L') || !inputField.text[2].Equals('T') || !inputField.text[3].Equals('P'))); UnityEPL.AddParticipant(inputField.text); SetSessionNumber(); inputField.gameObject.SetActive(false); Cursor.visible = false; //Add part here which calls eeg file checking script yield return(PressAnyKey(UnityEPL.GetParticipants()[0] + "\nsession " + UnityEPL.GetSessionNumber(), new KeyCode[] { KeyCode.Return }, textDisplayer)); yield return(PressAnyKey("Researcher:\nPlease confirm that the \nimpedance window is closed\nand that sync pulses are showing", new KeyCode[] { KeyCode.Y }, textDisplayer)); yield return(PressAnyKey("Researcher:\nPlease begin the EEG recording now\nand confirm that it is running.", new KeyCode[] { KeyCode.R }, textDisplayer)); yield return(EEGVerificationScript(UnityEPL.GetExperimentName(), UnityEPL.GetParticipants()[0], UnityEPL.GetSessionNumber())); scriptedEventReporter.ReportScriptedEvent("microphone test begin", new Dictionary <string, object>()); yield return(DoMicrophoneTest()); scriptedEventReporter.ReportScriptedEvent("microphone test end", new Dictionary <string, object>()); fullscreenTextDisplayer.textElements[0].alignment = TextAnchor.MiddleLeft; yield return(PressAnyKey(FIRST_INSTRUCTIONS_MESSAGE, new KeyCode[] { KeyCode.Return }, fullscreenTextDisplayer)); yield return(PressAnyKey(SECOND_INSTRUCTIONS_MESSAGE, new KeyCode[] { KeyCode.Return }, fullscreenTextDisplayer)); fullscreenTextDisplayer.textElements[0].alignment = TextAnchor.MiddleCenter; // Begin free recall trials for (int i = 0; i < numberOfLists; i++) { if (i != 0) { yield return(PressAnyKey("Press SPACE to continue.", new KeyCode[] { KeyCode.Space }, textDisplayer)); } textDisplayer.DisplayText("list count", "List " + (i + 1)); yield return(new WaitForSeconds(3f)); textDisplayer.ClearText(); yield return(DoCountdown()); string[] trialWords = new string[lengthOfList]; System.Array.Copy(words, i * lengthOfList, trialWords, 0, lengthOfList); Debug.Log(trialWords); yield return(PerformTrial(trialWords, i, false)); } //over textDisplayer.DisplayText("end message", "Yay, the session is over!"); }