Пример #1
0
 private new void Start()
 {
     base.Start();
     // Custom taskInfo initialization
     taskInfo            = gameObject.GetComponentInChildren <WisconsinTaskInfo>();
     taskInfo.OnPublish += Publish;
     // CurrentTrial placeholder
     currentTrial = new WisconsinTrialState();
     animator     = WisconsinGUIController.m_instance.stateMachine;
     // ReactionTimer
     reactionTimer           = new Timer(Time.deltaTime * 100);
     reactionTimer.Elapsed  += (object sender, ElapsedEventArgs e) => currentTrial.ReactionTime++;
     reactionTimer.AutoReset = true;
     reactionTimer.Enabled   = false;
     // GateTimer
     _gateTimer           = new Timer(10);
     _gateTimer.Elapsed  += (object sender, ElapsedEventArgs e) => gateTimer += 0.01f;
     _gateTimer.AutoReset = true;
     _gateTimer.Enabled   = false;
     // FixationTimer
     _fixationTimer           = new Timer(10);
     _fixationTimer.Elapsed  += (object sender, ElapsedEventArgs e) => fixationTimer += 0.01f;
     _fixationTimer.AutoReset = true;
     _fixationTimer.Enabled   = false;
     // Reset HUD
     HUDManager.instance.GenerateScore();
 }
Пример #2
0
    // This script prepares the trial during the intertrial phase
    public override void PrepareTrial()
    {
        currentTrial.quiet = true;
        currentTrial       = allTrials[0];
        allTrials.RemoveAt(0);
        if (allTrials.Count == 0)
        {
            PrepareAllTrials();
        }
        currentTrial.TrialIndex = currentTrialIndex;
        currentTrialIndex++;

        // Update Trial Details
        TrialDetailsManager.instance.UpdateTrialDetails(currentTrial);

        // Set default trial outcome
        currentTrial.IsCorrect = false;
        currentTrial.Outcome   = "Early response";
        currentTrial.quiet     = false;
    }
Пример #3
0
    public void UpdateTrialDetails(WisconsinTrialState current)
    {
        string trule = (current.TrialRule == 1 ? "Color" :
                        current.TrialRule == 2 ? "Shape" :
                        current.TrialRule == 3 ? "Number" : "Unknown");
        string tposition = (current.TargetPositionIndex == 0 ? "Bottom" :
                            current.TargetPositionIndex == 1 ? "Upper" :
                            current.TargetPositionIndex == 2 ? "Right" :
                            current.TargetPositionIndex == 3 ? "Left" : "Unknown");
        string sposition = (current.SelectedPositionIndex == 0 ? "Bottom" :
                            current.SelectedPositionIndex == 1 ? "Upper" :
                            current.SelectedPositionIndex == 2 ? "Right" :
                            current.SelectedPositionIndex == 3 ? "Left" : "Unknown");

        TrialIndicesLeft.text = current.TrialIndex.ToString() + "\n" +
                                trule + "\n" +
                                current.TrialRuleLength.ToString() + "\n" +
                                current.Response.ToString() + "\n";
        TrialIndicesRight.text = (current.TrialRuleLength == 0 ? "New Rule" : "Same Rule") + "\n" +
                                 tposition + "\n" +
                                 sposition + "\n" +
                                 current.Outcome;
    }
Пример #4
0
    void AssignTrialProperties(int _modifiers, int _conditionTypes, int _responseTypes, int rule, int target_offset, Color[] _color, int[] _shape, int[] _number, int ruleLength)
    {
        WisconsinTaskInfo myTaskInfo = WisconsinTaskInfo.m_instance;

        WisconsinTrialState.TargetObject[] TargetObjectList = new WisconsinTrialState.TargetObject[5];
        TargetObjectList[0] = new TargetObject(_shape[0], _color[0], _number[0]);
        TargetObjectList[1] = new TargetObject(_shape[1], _color[1], _number[1]);
        TargetObjectList[2] = new TargetObject(_shape[2], _color[2], _number[2]);
        TargetObjectList[3] = new TargetObject(_shape[3], _color[3], _number[3]);
        TargetObjectList[4] = new TargetObject(_shape[4], _color[4], _number[4]);

        var taskParams = new WisconsinTrialState()
        {
            TaskName              = taskInfo.taskName,
            Modifier              = myTaskInfo.myModifiers[_modifiers],
            Condition             = myTaskInfo.myConditionTypes[_conditionTypes],
            Response              = myTaskInfo.myResponseTypes[_responseTypes],
            TargetPositionIndex   = target_offset,
            TargetObjectL         = TargetObjectList,
            SelectedPositionIndex = target_offset,
            TrialRule             = rule,
            TrialRuleLength       = ruleLength
        };

        switch (_modifiers)
        {
        // Prosacccade Trials
        case 0 when _responseTypes == 0:
            proTrials.Add(taskParams);
            break;

        // Undesirable combinations (Debug)
        default:
            //trashedTrials.Add(taskParams);
            break;
        }
    }
Пример #5
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     WisconsinExperimentController.m_instance.ShowTargets();
     startTime    = Time.time;
     currentTrial = WisconsinExperimentController.m_instance.currentTrial;
 }