//We are gonna generate all the trials here.
        private void GenerateTrials()
        {
            AbstractTrial currentTrial = this;

            foreach (var i in DS.GetData().BlockOrder)
            {
                var           l        = i - 1;
                var           block    = DS.GetData().Blocks[l];
                var           newBlock = true;
                AbstractTrial currHead = null;

                var tCnt = 0;
                foreach (var j in block.TrialOrder)
                {
                    var           k = j - 1;
                    AbstractTrial t;

                    // Here we decide what each trial is, I guess we could do this with a function map, but later.
                    // here we have a picture as a trial.
                    if (k < 0)
                    {
                        t = new RandomTrial(l, k);
                    }
                    else
                    {
                        var trialData = DS.GetData().Trials[k];

                        // Control flow here is for deciding what Trial gets spat out from the config
                        if (trialData.FileLocation != null)
                        {
                            Debug.Log("Creating new Instructional Trial");
                            t = new InstructionalTrial(l, k);
                        }
                        else if (trialData.TwoDimensional == 1)
                        {
                            Debug.Log("Creating new 2D Screen Trial");
                            t = new TwoDTrial(l, k);
                        }
                        else
                        {
                            Debug.Log("Creating new 3D Screen Trial");
                            t = new ThreeDTrial(l, k);
                        }
                    }
                    if (newBlock)
                    {
                        currHead = t;
                    }

                    t.isTail = tCnt == block.TrialOrder.Count - 1;
                    t.head   = currHead;

                    currentTrial.next = t;

                    currentTrial = currentTrial.next;

                    newBlock = false;
                    tCnt++;
                }

                currentTrial.next = new CloseTrial(-1, -1);
            }
        }
Exemple #2
0
        //We are gonna generate all the trials here.
        private void GenerateTrials()
        {
            Debug.Log("GenerateTrial");
            AbstractTrial currentTrial    = this;
            var           i               = BlockID;
            var           block           = DS.GetData().Blocks[i];
            var           n               = block.RandomlySelect.Count;
            var           randomSelection = Random.Range(0, n);

            var d = block.RandomlySelect[randomSelection];

            if (block.Replacement == 0)
            {
                block.RandomlySelect.Remove(d);
            }
            Debug.Log("RANDOM TRIAL CREATION");


            //Need this to remove the previously generated random trials.
            while (_numGenerated > 0)
            {
                //next = next.next;

                _numGenerated--;
            }

            var trueNext = next;

            var tCnt = 0;

            foreach (var j in d.Order)
            {
                //Here we decide what each trial is, I guess we could do this with a function map, but later.
                //here we have a picture as a trial.
                var trialData = DS.GetData().Trials[j - 1];

                //Control flow here is for deciding what Trial gets spat out from the config

                AbstractTrial t;
                if (trialData.FileLocation != null)
                {
                    Debug.Log("Creating new Loading Screen Trial");
                    t = new InstructionalTrial(i, j - 1);
                }
                else if (trialData.TwoDimensional == 1)
                {
                    Debug.Log("Creating new 2D Screen Trial");

                    t = new TwoDTrial(i, j - 1);
                }
                else
                {
                    Debug.Log("Creating new 3D Screen Trial");

                    t = new ThreeDTrial(i, j - 1);
                }



                t.isTail = tCnt == d.Order.Count - 1 && isTail;
                t.head   = head;

                currentTrial.next = t;

                currentTrial = currentTrial.next;
                _numGenerated++;
                tCnt++;
            }

            currentTrial.next = trueNext;
        }