/// <summary> /// Ends the session if the supplied trial is the last trial. /// </summary> public void EndIfLastTrial(Trial trial) { if (trial == LastTrial) { End(); } }
/// <summary> /// Create a trial within this block /// </summary> /// <returns></returns> public Trial CreateTrial() { var t = new Trial(this); trials.Add(t); return(t); }
/// <summary> /// Create a block with a given number of trials under a given session /// </summary> /// <param name="numberOfTrials"></param> /// <param name="session"></param> public Block(uint numberOfTrials, Session session) { this.session = session; this.session.blocks.Add(this); settings.SetParent(this.session.settings); for (int i = 0; i < numberOfTrials; i++) { var t = new Trial(this); trials.Add(t); } }
void MakePracticeTrials(Block block, double[] angles) { int counterBecauseCSharpNoob = 0; foreach (double i in angles) { Trial trial = block.trials[counterBecauseCSharpNoob]; trial.settings.SetValue("angle", i); trial.settings.SetValue("targetSize", 0.015); counterBecauseCSharpNoob++; } // shuffle the trial order, so the catch trials are in random positions block.trials.Shuffle(); }
public void ResetPosition(UXF.Trial trial) { string mode = trial.settings["mode"].ToString(); if (string.Equals(mode, "horizontal")) { transform.localPosition = horizontalOrigin.localPosition; Debug.LogFormat("Position reset to {0}", transform.localPosition); } else if (string.Equals(mode, "vertical")) { transform.localPosition = verticalOrigin.localPosition; Debug.LogFormat("Position reset to {0}", transform.localPosition); } }
public void Generate(Session session) { double[] angles = new double[] { 0, 45, 90 }; double[] targetSizes = new double[] { .004, .015, .020 }; int numPracticeTrials = 3; // create two blocks Block dummyBlock = session.CreateBlock(1); Block practiceBlock = session.CreateBlock(numPracticeTrials); Block block = session.CreateBlock(angles.Length * targetSizes.Length); Trial trial = dummyBlock.trials[0]; trial.settings.SetValue("angle", 0); trial.settings.SetValue("targetSize", 0); MakePracticeTrials(practiceBlock, angles); MakeTrials(block, angles, targetSizes); Debug.Log(block.trials); }
public void SceneEnd(UXF.Trial trial) { AssessmentType type = (AssessmentType)trial.settings.GetObject("assessment_type"); switch (type) { case AssessmentType.Vision: ShowFixation(false); break; case AssessmentType.NoVision: SwitchLights(true); break; case AssessmentType.RoomOscillate: ShowFixation(true); ToggleOscillation(false); break; } }
// Call whenever a new trial session is launched public void ExperimentTrialBegin(UXF.Trial experimentTrial) { ApollonEngine.Instance.ExperimentTrialBegin(experimentTrial); }
void TrialEnd(Trial trial) { trialStatus.text = "Trial finished"; }
void TrialBegin(Trial trial) { trialStatus.text = "Trial in progress"; trialNum.text = FormatProgress("Trial", trial.number, trial.session.Trials.ToList().Count); blockNum.text = FormatProgress("Block", trial.block.number, trial.session.blocks.Count); }