Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;

        state = Test_3FStates.PREPARATION;
        Node root = new Node();

        BuildTree(root);
        InstTree(root);

        VRController          = RigidbodyFirstPersonController.GetInstance().transform;
        leftEye               = VRController.Find("Fove Interface").Find("FOVE Eye (Left)").GetComponent <applyShader>();
        rightEye              = VRController.Find("Fove Interface").Find("FOVE Eye (Right)").GetComponent <applyShader>();
        VRController.position = new Vector3(-0.894f, -1.102f, -0.711f);

        // I can maybe add a second FOVE interface with a "Please Wait" screen
        leftEye.SetBlackening(true);
        rightEye.SetBlackening(true);

        // It would be better to have an input scheme but this is effective until we get a controller
        controlCam.transform.parent.GetComponent <Pivot_rotate>().active     = true;
        VRController.GetComponent <RigidbodyFirstPersonController>().enabled = false;
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (Time.timeSinceLevelLoad < 0.1f)
        {
            // Doing it on start has weird effects.
            leftEye  = VRController.Find("Fove Interface").Find("FOVE Eye (Left)").GetComponent <applyShader>();
            rightEye = VRController.Find("Fove Interface").Find("FOVE Eye (Right)").GetComponent <applyShader>();
            leftEye.SetBlackening(true);
            rightEye.SetBlackening(true);
        }
        switch (state)
        {
        case Test_3FStates.PREPARATION:
            // Possibly allow to rotate the object or rotate it automatically

            if (StaticValues.configurations.Count == StaticValues.resolutions.Count * StaticValues.angles.Count)
            {
                StaticValues.sw.WriteLine("\t\t\t{");
                // This is for doing multiple iterations WITHOUT a pause in the middle
                //StaticValues.sw.WriteLine("\t\t\t\t\"iteration\" : \"" + (StaticValues.runCount+1).ToString() + "\",");
                // This is with a pause in the middle, adding the iteration by hand.
                StaticValues.sw.WriteLine("\t\t\t\t\"iteration\" : \"" + StaticValues.iterVal + "\",");
                StaticValues.iterVal++;
                StaticValues.sw.WriteLine("\t\t\t\t\"runs\" : [");
            }

            if (StaticValues.configurations.Count > 0 && !resUpdated)
            {
                Vector3 tmp = Pop(StaticValues.configurations);
                currRes = new Vector2(tmp.x, tmp.y);

                if (leftEye != null && rightEye != null)
                {
                    leftEye.SetResolution(currRes);
                    leftEye.SetViewingAngle(tmp.z);
                    rightEye.SetResolution(currRes);
                    rightEye.SetViewingAngle(tmp.z);
                }
                StaticValues.sw.WriteLine("\t\t\t\t\t{");
                StaticValues.sw.WriteLine("\t\t\t\t\t\t\"resolution\" : \"" + currRes.x.ToString() + "/" + currRes.y.ToString() + "\",");
                StaticValues.sw.WriteLine("\t\t\t\t\t\t\"angle\" : \"" + tmp.z.ToString() + "\",");
                resUpdated = true;

                Debug.Log((StaticValues.runCount + 1).ToString() + " - " + (12 - StaticValues.configurations.Count).ToString());
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                state = Test_3FStates.SIMULATION;
                begin = System.DateTime.Now;
                controlCam.transform.Find("Canvas").Find("lower").GetComponent <Text>().text = "";
                controlCam.transform.parent.GetComponent <Pivot_rotate>().active             = false;
                VRController.GetComponent <CameraOnAStick>().enabled = true;
                leftEye.SetBlackening(false);
                rightEye.SetBlackening(false);
            }
            break;

        case Test_3FStates.SIMULATION:
            // The examinator takes the time, confirming the answer once the correct one is reached.
            //deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
            //float fps = 1.0f / deltaTime;
            //Debug.Log(fps);

            if (Input.GetKeyDown(KeyCode.Space))
            {
                controlCam.transform.Find("Canvas").Find("lower").GetComponent <Text>().text = "Enter the accuracy";

                /*
                 * infield = controlCam.transform.Find("Canvas").Find("accuracy").GetComponent<InputField>();
                 * infield.gameObject.SetActive(true);
                 * infield.ActivateInputField();
                 * infield.Select();
                 */

                end     = System.DateTime.Now;
                elapsed = (end - begin).ToString();
                string[] tmp = elapsed.Split(':');
                elapsed = tmp[1] + ":" + tmp[2].Substring(0, 6);

                leftEye.SetBlackening(true);
                rightEye.SetBlackening(true);
                state = Test_3FStates.EVALUATION;
            }
            break;

        case Test_3FStates.EVALUATION:
            controlCam.transform.Find("Canvas").Find("lower").GetComponent <Text>().text = "Press Space to start";

            // Child 2 is the instantiated clone
            StaticValues.sw.WriteLine("\t\t\t\t\t\t\"name\" : \"" + targ.name.Split('(')[0] + "\",");
            //StaticValues.sw.WriteLine("\t\t\t\t\"result\" : \"" + (infield.GetComponent<InputEditor>().written) + "\",");
            StaticValues.sw.WriteLine("\t\t\t\t\t\t\"elapsed\" : \"" + elapsed + "\"");
            if (StaticValues.configurations.Count == 0)
            {
                StaticValues.sw.WriteLine("\t\t\t\t\t}");
                StaticValues.sw.WriteLine("\t\t\t\t]");                         //sets
                if (StaticValues.runCount == runs - 1)
                {
                    StaticValues.sw.WriteLine("\t\t\t}");                             //experiments
                }
                else
                {
                    StaticValues.sw.WriteLine("\t\t\t},");                             //experiments
                }
            }
            else
            {
                StaticValues.sw.WriteLine("\t\t\t\t\t},");
            }
            elapsed = "";
            Quit();
            break;
        }
    }