Beispiel #1
0
    TSGamePiece spawnPiece(StimuliSet set)
    {
        toggleAllPiecesVisible(isVisible: false);
        TSGamePiece piece      = choosePieceToSpawn();
        int         pieceIndex = ArrayUtil.IndexOf(boardPieces, piece);

        this.activeTile = boardTiles[pieceIndex];
        piece.SetPiece(batch, set);
        activeTile.SetPiece(piece);
        this.currentTask = trackTask(set, pieceIndex);
        return(piece);
    }
Beispiel #2
0
    TSTaskDescriptor trackTask(StimuliSet set, int stimulusPosition)
    {
        TSTaskDescriptor task = new TSTaskDescriptor();

        task.BlockName        = data.CurrentBatch.ToString();
        task.StimulusPosition = stimulusPosition;
        task.TaskType         = (int)boardTiles[stimulusPosition].GetMatchType + 1;
        if (batch is HybridTaskBatch)
        {
            ImageStimuliSet imageSet    = set as ImageStimuliSet;
            HybridTaskBatch hybridBatch = batch as HybridTaskBatch;
            if (imageSet.HasImage1)
            {
                task.Stimuli1Index = hybridBatch.GetStimuli1Index(imageSet.Stimuli1Img);
            }
            else
            {
                task.Stimuli1Index = hybridBatch.GetStimuli1Index(imageSet.Stimuli1);
            }
            if (imageSet.HasImage2)
            {
                task.Stimuli2Index = hybridBatch.GetStimuli2Index(imageSet.Stimuli2Img);
            }
            else
            {
                task.Stimuli2Index = hybridBatch.GetStimuli2Index(imageSet.Stimuli2);
            }
        }
        else if (set is ImageStimuliSet)
        {
            ImageStimuliSet imageSet   = set as ImageStimuliSet;
            ImageTaskBatch  imageBatch = batch as ImageTaskBatch;
            task.Stimuli1Index = imageBatch.GetStimuli1Index(imageSet.Stimuli1Img);
            task.Stimuli2Index = imageBatch.GetStimuli2Index(imageSet.Stimuli2Img);
        }
        else
        {
            task.Stimuli1Index = batch.GetStimuli1Index(set.Stimuli1);
            task.Stimuli2Index = batch.GetStimuli2Index(set.Stimuli2);
        }
        task.TypeOfBlock = ((int)data.CurrentBatchIndex) + 1;
        TSTaskType taskType = data.IsTaskSwitch ? TSTaskType.TaskSwitch : TSTaskType.TaskRepeat;

        task.IsNewTaskSwitch = (int)taskType;
        data.StartTimer(getTaskKey());
        return(task);
    }
 public void SetPiece(TaskBatch batch, StimuliSet set)
 {
     if (batch is HybridTaskBatch)
     {
         setPieceHybrid(set as ImageStimuliSet);
     }
     else if (batch is ImageTaskBatch)
     {
         ImageStimuliSet imgSet = set as ImageStimuliSet;
         setPiece(imgSet.Stimuli1Img, imgSet.Stimuli2Img);
     }
     else
     {
         setPiece(set.Stimuli1, set.Stimuli2);
     }
     ToggleVisible(isVisibile: true);
 }
Beispiel #4
0
    IEnumerator spawnCoroutine()
    {
        while (this.spawningActive)
        {
            yield return(new WaitForSeconds(spawnDelay));

            TSGameTile previousTile = activeTile;
            bool       tooSlow      = false;
            if (hasCurrentTask)
            {
                sendTask(currentTask, TSResponseStatus.TooSlow, 0, 0);
                tooSlow = true;
            }
            rightButton.SetActive();
            leftButton.SetActive();
            toggleAllTileIcons(visible: false);
            StimuliSet stimuli = data.GetSet();
            spawnPiece(stimuli);
            if (tooSlow && previousTile)
            {
                previousTile.TimedShowIcon(successfulPlacement: false);
            }
        }
    }
    public override StimuliSet GetSet()
    {
        ImageStimuliSet set     = new ImageStimuliSet();
        StimuliSet      sample1 = batch1.GetSet();
        StimuliSet      sample2 = batch2.GetSet();

        if (sample1 is ImageStimuliSet && (sample1 as ImageStimuliSet).HasImage1)
        {
            set.Stimuli1Img = (sample1 as ImageStimuliSet).Stimuli1Img;
        }
        else
        {
            set.Stimuli1 = sample1.Stimuli1;
        }
        if (sample2 is ImageStimuliSet && (sample2 as ImageStimuliSet).HasImage2)
        {
            set.Stimuli2Img = (sample2 as ImageStimuliSet).Stimuli2Img;
        }
        else
        {
            set.Stimuli2 = sample2.Stimuli2;
        }
        return(set);
    }