Ejemplo n.º 1
0
    public void nextStep()
    {
        //Add the time to the record
        gameObject.GetComponent <timer>().pauseTime();
        float tempTime = gameObject.GetComponent <timer> ().getTime();

        trialCount++;

        backgroundName = GameObject.FindGameObjectWithTag("desktop").transform.name;
        times.addRecord(tempTime, methodName, backgroundName, trialCount, false);
        Debug.Log(trialCount + ", " + methodName + ", " + backgroundName);
        gameObject.GetComponent <timer> ().resetTime();

        //If the last trial of the current type is finished, move to the next cursor desktop. If there is no next desktop, move to the next cursor method
        counter++;
        if (counter == subTrialCount)
        {
            counter = 0;
            desktopCount++;

            if (desktopCount == (desktop.Length))
            {
                desktopCount = 0;
                reshuffle(desktop);
                cursorCount++;

                if (cursorCount == (cursor.Length))
                {
                    cursorCount = 0;
                    printData();
                    Application.LoadLevel("testingCompleted");
                    return;
                }
            }
        }

        GameObject.Find("clicktocontinue").GetComponent <clickToContinue> ().show();

        //added to show a previw of the mouse type before each trial
        GameObject previewMouse = (GameObject)Instantiate(cursor[cursorCount]);

        previewMouse.transform.position = new Vector3(0f, -3.0f, -4.0f);
        previewMouse.name = "previewMouse";
        previewMouse.GetComponent <SpriteRenderer> ().sortingOrder = 150;
        previewMouse.GetComponent <Collider2D> ().enabled          = false;
        previewMouse.GetComponent <cursorClicked> ().enabled       = false;

        //similarily, show the word target beside the preview mouse pointer
        GameObject target = (GameObject)Instantiate(targetObject);

        target.transform.position = new Vector3(0f, -2.07f, -0.0f);
        target.name = "target";
        target.GetComponent <SpriteRenderer> ().sortingOrder = 150;
    }