예제 #1
0
 public void ItemChosen(ItemChoice selectedItem)
 {
     if (_currentTaskState == TaskState.ProcessChoice)
     {
         _currentChoice = selectedItem;
     }
 }
예제 #2
0
    void UpdateDisplayForChoice(ItemChoice chosenItem, ChoiceResult result)
    {
        var choiceIdx = ((int)chosenItem);

        if (result == ChoiceResult.Correct)
        {
            _checks[choiceIdx].SetActive(true);
        }
        else
        {
            _crosses[choiceIdx].SetActive(true);
        }
    }
예제 #3
0
    void SetCorrectAnswerBasedOnChoiceProb(ItemChoice choice)
    {
        var probability = 0;

        // Don't count the previous item as an incorrect attempt
        if (_currentChoice == _previousCorrectChoice)
        {
            _correctChoice = ItemChoice.None;
            return;
        }

        // Process a new choice and use a distribution to determine they were correct
        switch (_choiceAttempt)
        {
        case 0:
            probability = 15;             // For the first response 15% of the time it will be correct
            break;

        case 1:
            probability = 33;             // For the second response it is 33%
            break;

        case 2:
            probability = 100;             // For the third choice it is always correct
            break;
        }

        if (Random.Range(1, 100) <= probability)
        {
            _correctChoice = choice;
            _choiceAttempt = 0;
            _interReversalIterationCount = 0;
        }
        else
        {
            _choiceAttempt++;
            _correctChoice = ItemChoice.None;
        }
    }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     itemChoice  = ItemChoice.DRESS;
     audioNumber = 0;
 }
예제 #5
0
        private void BtnAddItem_Click(object sender, RoutedEventArgs e)
        {
            ItemChoice temp = new ItemChoice(inventory);

            temp.Show();
        }
예제 #6
0
    void Update()
    {
        //Asking TimeManger if we are at end of trial...
        if (_timer.EndTrial == true)
        {
            _currentTaskState = TaskState.EndTrial;
        }

        //asking TimeManager if we are at end of a block...
        if (_trialType == TrialType.Both)
        {
            if (_timer.SwitchBlock == true)
            {
                if (CurrentBlockType == BlockType.Baseline)
                {
                    CurrentBlockType  = BlockType.Reversal;
                    _currentTaskState = TaskState.StartBlock;
                }
                else if (CurrentBlockType == BlockType.Reversal)
                {
                    CurrentBlockType  = BlockType.Baseline;
                    _currentTaskState = TaskState.StartBlock;
                }
            }
        }


        // MAIN STATE MACHINE
        switch (_currentTaskState)
        {
        case TaskState.WaitForTrigger:

            if (!Hourglass.activeInHierarchy)
            {
                Hourglass.SetActive(true);
            }

            break;

        case TaskState.StartTrial:

            ClearFeedback();
            _logger.Init();

            switch (_trialType)
            {
            case TrialType.Both:
                CurrentBlockType = BlockType.Baseline;
                break;

            case TrialType.Baseline:
                CurrentBlockType = BlockType.Baseline;
                break;

            case TrialType.Reversal:
                CurrentBlockType = BlockType.Reversal;
                break;
            }

            _currentTaskState = TaskState.StartBlock;

            break;

        case TaskState.StartBlock:

            switch (CurrentBlockType)
            {
            case BlockType.Baseline:
                StartBaseline();
                _blockLengthLimit = _baselineBlockLength;
                break;

            case BlockType.Reversal:
                StartReversal();
                _blockLengthLimit = _reversalBlockLength;
                break;
            }

            //start the block timer here, check end in Timer script
            BlockTimerStart   = DateTime.Now;
            _currentTaskState = TaskState.StartIteration;

            break;

        case TaskState.StartIteration:

            if (CurrentBlockType == BlockType.Baseline)
            {
                ClearFeedback();
                StartBaseline();
            }

            if (CurrentBlockType == BlockType.Reversal)
            {
                ClearFeedback();
                StartReversal();
            }


            _previousChoices = new List <ItemChoice>();

            if (CurrentBlockType == BlockType.Baseline || _previousCorrectChoice == ItemChoice.None)
            {
                SetCorrectAnswerRandomly();
            }
            else
            {
                SetCorrectAnswerToPrevious();
            }

            if (CurrentBlockType == BlockType.Baseline)
            {
                DisplayHint();
            }

            _iterationStartTime = Time.time;                     //start time of the iteration
            _currentTaskState   = TaskState.ProcessChoice;

            break;


        case TaskState.ProcessChoice:

            // Filter out no choice or repeated choices
            if (_currentChoice != ItemChoice.None && !_previousChoices.Contains(_currentChoice))
            {
                _previousChoices.Add(_currentChoice);

                if (_previousCorrectChoice == ItemChoice.None)
                {
                }

                if (CurrentBlockType == BlockType.Reversal && _interReversalIterationCount > _interReversalIterationNumber)                        // **RANDOMIZED # OF ITERATIONS BETWEEN REVERSAL BLOCKS**
                {
                    SetCorrectAnswerBasedOnChoiceProb(_currentChoice);
                    _reversalFlag = 1;     //marks occurance of reversals
                }

                if (_currentChoice == _correctChoice)
                {
                    UpdateDisplayForChoice(_currentChoice, ChoiceResult.Correct);

                    if (CurrentBlockType == BlockType.Reversal)
                    {
                        _attemptCount++;                                 //tally for total number of responses
                        _correctAttemptCount++;                          //tally for totaly number of CORRECT responses
                    }

                    if (CurrentBlockType == BlockType.Baseline)
                    {
                        _baselineAttemptCount++;
                        baselineCorrectAttemptCount++;
                    }
                    _iterationEndTime = Time.time;
                    _currentTaskState = TaskState.ReinforceIteration;
                }

                else
                {
                    UpdateDisplayForChoice(_currentChoice, ChoiceResult.Incorrect);

                    if (CurrentBlockType == BlockType.Reversal)
                    {
                        _attemptCount++;                                 //tally for total number of responses
                        _incorrectAttemptCount++;                        //tally for totaly number of INCORRECT responses

                        if (_reversalFlag == 1)
                        {
                            _incorrectAttemptOnReversalCount++;                                     // tally for the number of INCORRECT responses in a REVERSAL condition
                        }
                    }

                    if (CurrentBlockType == BlockType.Baseline)
                    {
                        _baselineAttemptCount++;
                        baselineIncorrectAttemptCount++;
                    }

                    _currentTaskState = TaskState.ProcessChoice;
                }

                _currentChoice = ItemChoice.None;
            }
            break;

        case TaskState.ReinforceIteration:

            var tmpTime = Time.time;
            _currentTaskState = tmpTime - _iterationEndTime >= 1.5 ? TaskState.EndIteration : TaskState.ReinforceIteration;                     //FIX THIS : MAKE THE DELAY CONFIGURABLE

            break;

        case TaskState.EndIteration:

            //blockTimerEnd = DateTime.Now;
            _currentTrialLength = Time.timeSinceLevelLoad - ScannerDelay;

            _previousCorrectChoice = _correctChoice;
            _interReversalIterationCount++;

            _logger.LogRaw(_reversalIterationCount + " , " + _attemptCount + " , " + _correctAttemptCount + " , " + _incorrectAttemptCount + " , " + _incorrectAttemptOnReversalCount + " , " + _responseTime +
                           " , " + _reversalCount + " , " + _reversalResponseTime + " , " + baselineIterationCount + " , " + baselineResponseTime + " , " + _baselineAttemptCount + " , " + baselineCorrectAttemptCount + " , "
                           + baselineIncorrectAttemptCount);

            if (CurrentBlockType == BlockType.Reversal)
            {
                _reversalIterationCount++;                                    //tally of the number of iterations presented
                _responseTime      = _iterationEndTime - _iterationStartTime; //calculating time in between CORRECT responses (response time)
                _totalResponseTime = _totalResponseTime + _responseTime;      //total response time compiler. compiles the time it takes to get the correct answer (the time taken to complete iteration) --> used to calculate average

                if (_reversalFlag == 1)                                       // checking if reversal has occured and pulling that time frame from _responseTime
                {
                    _interReversalIterationNumber = Random.Range(4, 7);
                    _reversalResponseTime         = _responseTime;
                    _totalReversalResponseTime    = _totalReversalResponseTime + _reversalResponseTime; //compiling total response time in reversal situation
                    _reversalCount++;                                                                   //compiles number of reversals as they occur
                    _reversalFlag = 0;                                                                  //resets reversal marker
                }
            }

            if (CurrentBlockType == BlockType.Baseline)                     //baseline block metrics
            {
                baselineIterationCount++;
                baselineResponseTime       = _iterationEndTime - _iterationStartTime;
                _totalBaselineResponseTime = _totalBaselineResponseTime + baselineResponseTime;
            }

            if (_trialType != TrialType.Both)
            {
                _currentTaskState = TaskState.StartIteration;
            }

            //if (_trialType == TrialType.All && ((blockTimerEnd - blockTimerStart).Seconds > blockLengthLimit))
            //{
            //	_currentTaskState = TaskState.EndBlock;
            //}

            else
            {
                _currentTaskState = TaskState.StartIteration;
            }

            //            if (_trialLength > _trialLengthLimit) //**SET THIS TO A GIVEN TIME PERIOD (9 MIN WAS DISCUSSED - 540 sec)**
            //{
            //	_currentTaskState = TaskState.EndTrial;
            //}

            break;

        case TaskState.EndBlock:

            if (CurrentBlockType == BlockType.Baseline)
            {
                CurrentBlockType = BlockType.Reversal;
            }

            else if (CurrentBlockType == BlockType.Reversal)
            {
                CurrentBlockType = BlockType.Baseline;
            }

            _currentTaskState = TaskState.StartBlock;
            break;

        case TaskState.EndTrial:

            _averageResponseTime         = _totalResponseTime / _reversalIterationCount;                                                                                                                                                                                                                                                 // average response time to get correct answer over course of the whole trial
            _averageReversalResponseTime = _totalReversalResponseTime / _reversalCount;                                                                                                                                                                                                                                                  // average response time to reversal condition
            averageBaselineResponseTime  = _totalBaselineResponseTime / baselineIterationCount;                                                                                                                                                                                                                                          // baseline block metrics

            _logger.LogReversalSummary("ReversalIterationCount , trialDuration , averageResponseTime , reversalCount , averageReversalResponseTime" + Environment.NewLine + _reversalIterationCount + " , " + _timer.CurrentTrialLength + " , " + _averageResponseTime + " , " + _reversalCount + " , " + _averageReversalResponseTime); // summery metrics for whole trial
            _logger.LogBaselineSummary("BaselineIterationCount , trialDuration , baselineCorrectCount , baselineIncorrectCount , averageBaselineResponseTime" + Environment.NewLine + baselineIterationCount + " , " + _timer.CurrentTrialLength + " , " + baselineCorrectAttemptCount + " , " + baselineIncorrectAttemptCount + " , " + averageBaselineResponseTime);
            _logger.Term();

            SceneManager.LoadScene("GameEndScreen_Stimulation");

            break;
        }
    }
예제 #7
0
    void SetCorrectAnswerRandomly()
    {
        var itms = Enum.GetValues(typeof(ItemChoice));

        _correctChoice = (ItemChoice)itms.GetValue(Random.Range(0, 4));            // Yes, 1, 4 is correct.  Idx 0 is none.
    }
예제 #8
0
 void SetCorrectAnswerToPrevious()
 {
     _correctChoice = _previousCorrectChoice;
 }
예제 #9
0
        private void btnAddItem_Click(object sender, RoutedEventArgs e)
        {
            ItemChoice i = new ItemChoice(inventory);

            i.Show();
        }