void buttonClicked(Button b, char id)
    {
        if (!answerLock)
        {
            if (id == 'b' && TrialChooser.blueIsAboveRed)
            {
                reportText.text = "Correct";
            }
            else if (id == 'b' && !TrialChooser.blueIsAboveRed)
            {
                reportText.text = "Incorrect";
            }

            if (id == 'r' && !TrialChooser.blueIsAboveRed)
            {
                reportText.text = "Correct";
            }
            else if (id == 'r' && TrialChooser.blueIsAboveRed)
            {
                reportText.text = "Incorrect";
            }

            if (id == 'y' && TrialChooser.blueCanSeeRed)
            {
                reportText.text = "Correct";
            }
            else if (id == 'y' && !TrialChooser.blueCanSeeRed)
            {
                reportText.text = "Incorrect";
            }

            if (id == 'n' && !TrialChooser.blueCanSeeRed)
            {
                reportText.text = "Correct";
            }
            else if (id == 'n' && TrialChooser.blueCanSeeRed)
            {
                reportText.text = "Incorrect";
            }

            answerLock = true;
            count++;
            score += reportText.text == "Correct" ? 1 : 0;
            scoreText.text = "Score: " + score.ToString();

            string header = "Participant Name,Technique,Task Number,Task Location, Task Type, Block, Time, Value\n";
            string format = "{0},{1},{2},{3},{4},{5},{6},{7}\n";

            if (!System.IO.File.Exists(scoreFile))
                System.IO.File.WriteAllText(scoreFile,header);
            string[] task = taskName.Split(':');
            string output = string.Format(format, participantName, NavigationToggle.getActiveTechniques()[0], task[0], task[1], task[2], count, (Time.time - time), reportText.text);
            System.IO.File.AppendAllText(scoreFile, output);
        }
        //Debug.Log(Time.time - time);
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        instance   = this;
        m_Drowdown = GetComponent <Dropdown>();
        m_Drowdown.onValueChanged.AddListener(delegate { ChangeNavigationTool(m_Drowdown); });

        techs = new List <MonoBehaviour>();

        techs.Add(lookFromAt); //0
        techs.Add(snapCam);    //1
        techs.Add(tranCam);    //2

        techs.Add(lookAtFrom); //3
        techs.Add(revSnapCam); //4

        techs.Add(dragZoom);   //5

        techs.Add(egoCam);     //6
        techs.Add(fixedTran);  //7
    }