コード例 #1
0
 /// <summary>
 /// Ends the session if the supplied trial is the last trial.
 /// </summary>
 public void EndIfLastTrial(Trial trial)
 {
     if (trial == LastTrial)
     {
         End();
     }
 }
コード例 #2
0
        /// <summary>
        /// Create a trial within this block
        /// </summary>
        /// <returns></returns>
        public Trial CreateTrial()
        {
            var t = new Trial(this);

            trials.Add(t);
            return(t);
        }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
        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();
        }
コード例 #5
0
    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);
        }
    }
コード例 #6
0
        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);
        }
コード例 #7
0
    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;
        }
    }
コード例 #8
0
 // Call whenever a new trial session is launched
 public void ExperimentTrialBegin(UXF.Trial experimentTrial)
 {
     ApollonEngine.Instance.ExperimentTrialBegin(experimentTrial);
 }
コード例 #9
0
 void TrialEnd(Trial trial)
 {
     trialStatus.text = "Trial finished";
 }
コード例 #10
0
 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);
 }