Пример #1
0
    void OnEnable()
    {
        codes = allSegments[randomIndexes[segmentHolderIndex]].codeSegments;
        print("time on start:" + Time.time);
        Time.timeScale = 0;
        string[] randomizedCodes;

        initialCodes    = new string[codes.Length];
        randomizedCodes = new string[codes.Length];
        for (int j = 0; j < codes.Length; j++)
        {
            initialCodes[j]    = codes[j].getCode();
            randomizedCodes[j] = initialCodes[j];
        }

        RandomizeArray.randomize(randomizedCodes, randomizedCodes.Length);

        int i = 0;

        foreach (var code in codeHolders)
        {
            code.text = randomizedCodes[i];
            i++;
        }
    }
 public void AddNewRecepiesToQueue()
 {
     RandomizeArray.Randomize <Recipe>(recipesForQueueing);
     foreach (var recipe in recipesForQueueing)
     {
         recipesQueue.Enqueue(recipe);
     }
 }
Пример #3
0
    void SetFirstNRandomIndexes(int numberOfSegments)
    {
        randomIndexes = new int[numberOfSegments];
        for (int i = 0; i < numberOfSegments; i++)
        {
            randomIndexes[i] = i;
        }

        RandomizeArray.randomize(randomIndexes, numberOfSegments);
    }
    void Awake()
    {
        Instance = this;

        activeRecipesClones = new Recipe[activeRecipes.Length];
        for (int i = 0; i < activeRecipes.Length; i++)
        {
            activeRecipesClones[i] = CloneRecipe(activeRecipes[i]);
        }
        recipesQueue = new Queue <Recipe>();
        RandomizeArray.Randomize <Recipe>(recipesForQueueing);
        AddNewRecepiesToQueue();
    }
Пример #5
0
 public void nextTrial()
 {
     trialSeqCounter = trialSeqCounter + 1;
     cubeSeqCounter  = cubeSeqCounter + 1;
     // reshuffle cube appearance after one "cube order" (emsCurrently 3 objects) has been presented
     if (cubeSeqCounter == CubeSeq.Length - 1)
     {
         cubeSeqCounter = 0;
         RandomizeArray.ShuffleArray(CubeSeq); // Re-Randomize Cube Appearance Sequence
         // in TU Berlin experiment (04/2018) cube location is not considered a factor of interest
         // and is not going to be examined. Therefore randomize appearance of cube locations!
     }
     // set wait time to 2 second, displays visual feedback for 2 second before hiding it and starting next trial
     if (actualTime < -2.5f)
     {
         actualTime = -2.5f;
     }
     updateEndOfTrialLogic = true;
 }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        NormalConflictArr = new int[nrOfTrials];

        if (vibroFeedbackCondition)
        {
            feedback_type = "vibro";
        }
        else if (emsFeedbackCondition)
        {
            feedback_type = "ems";
        }
        else
        {
            feedback_type = "visual";
        }

        // init LSL markerstream
        marker = FindObjectOfType <LSLMarkerStream>();

        // init arduino
        arduino = Arduino.global;
        arduino.Setup(ConfigurePins);

        // Finding the game object
        table         = GameObject.Find("Table");
        plane         = GameObject.Find("Plane");
        leapmotion    = GameObject.Find("LeapHandController");
        instruct      = GameObject.Find("IntroGUI");
        textBox       = GameObject.Find("TextBox");
        endexp        = GameObject.Find("End");
        startPos      = GameObject.Find("startPosDisc");
        resting       = GameObject.Find("resting");
        questionnaire = GameObject.Find("questionnaire");
        q             = GameObject.Find("question");
        ra            = GameObject.Find("right_anchor");
        la            = GameObject.Find("left_anchor");
        send          = GameObject.Find("send");

        // rehastim interface
        rehastim = GameObject.Find("RehaStim");

        // For Big Cube
        cubeLeft   = GameObject.Find("CubeLeft");
        cubeMiddle = GameObject.Find("CubeMiddle");
        cubeRight  = GameObject.Find("CubeRight");

        // Assign game objects to arrays
        cubeGameObjArr[0] = cubeLeft;
        cubeGameObjArr[1] = cubeMiddle;
        cubeGameObjArr[2] = cubeRight;

        // Randomize Cube Appearance Sequence
        RandomizeArray.ShuffleArray(CubeSeq);

        // Trial definition error with 1s and 0s for either conflict or normal trial depending on volatility of simulation
        if (!training)
        {
            NormalConflictArr = RandomizeArray.GenerateArraySequences(nrOfTrials, 0.1, 5);
        }

        // todo fix GenerateArraySequence function so volatility param works
        // if (volatility == 1)
        // {
        //     NormalConflictArr = RandomizeArray.GenerateArraySequences(nrOfTrials, 0.1, 5);
        // }
        // else if (volatility == 0)
        // {
        //     NormalConflictArr = RandomizeArray.GenerateArraySequences(nrOfTrials, 0.1, 5);
        // }

        // instruct and leapmotion game object remain visible and only table, plane and the end instruction are made invisible
        table.gameObject.GetComponent <Renderer>().enabled             = false;
        plane.gameObject.GetComponent <Renderer>().enabled             = false;
        instruct.gameObject.gameObject.GetComponent <Canvas>().enabled = true;
        endexp.gameObject.gameObject.GetComponent <Canvas>().enabled   = false;
        resting.gameObject.GetComponent <Renderer>().enabled           = false;
        questionnaire.SetActive(false);

        // hide startPosDisc
        startPos.SetActive(false);
        DisableAllCube(); // set color to white, disable renderer and sphereCollider
    }