Example #1
0
    IEnumerator ChangePosition()
    {
        GameObject    emptyObject       = GameObject.Find("dataSaver");
        dataSaver     dataSaver         = emptyObject.GetComponent <dataSaver> ();
        int           columnInHistogram = dataSaver.columnInHistogram;
        LSL_BCI_Input lslScript         = dataSaver.getLslScript();

        lslScript.setMarker("score_score_" + columnInHistogram.ToString());

        float x_position = this.right_column_x_position - this.distance_between_columns * (this.highest_column_index -
                                                                                           columnInHistogram);
        Vector3 vec = new Vector3(x_position, this.y_position_for_x_marker, this.z_position_for_x_marker);

        transform.localPosition = vec;

        yield return(new WaitForSeconds(9));

        int blockIndex = dataSaver.currentBlockIndex - 1;

        if (blockIndex == dataSaver.halfConditionIndex ||
            blockIndex == dataSaver.fullConditionIndex)
        {
            SceneManager.LoadScene("stress_evaluation");
        }
        else
        {
            SceneManager.LoadScene("Instructions");
        }
    }
Example #2
0
    void Start()
    {
        GameObject emptyObject = GameObject.Find("dataSaver");

        dataSaverScript = emptyObject.GetComponent <dataSaver> ();
        this.lslScript  = dataSaverScript.getLslScript();

        if (dataSaverScript.getIsLastPractice())
        {
            timeLimit = int.MaxValue;
        }
        currentItemIndex = 0;

        // Find sliders objects and initialize their methods
        sliderUnpleasentObj       = GameObject.Find("Slider_unPleasent");
        sliderStressObj           = GameObject.Find("Slider_stress");
        sliderUnpleasentComponent = sliderUnpleasentObj.GetComponent <Slider> ();
        sliderStressComponent     = sliderStressObj.GetComponent <Slider> ();

        sliderStressComponent.onValueChanged.AddListener(delegate {
            stressValueChanged();
        });
        sliderUnpleasentComponent.onValueChanged.AddListener(delegate {
            unpleasentValueChanged();
        });

        items = new Slider[] { sliderStressComponent, sliderUnpleasentComponent };

        // paint in green the active slider (the first one), and the rest in black
        int index = 0;

        for (index = 0; index < items.Length; index++)
        {
            UnityEngine.UI.Image[] images = items [index].GetComponentsInChildren <UnityEngine.UI.Image> ();
            for (int i = 0; i < images.Length; i++)
            {
                if (images [i].name == "Background")
                {
                    if (index == 0)
                    {
                        images [i].color = Color.green;
                    }
                    else
                    {
                        images [i].color = Color.black;
                    }
                }
            }
        }

        this.lslScript.setMarker("eval_start_1_stress_1");
        this.startTime = Time.time;
    }
    void Start()
    {
        GameObject stressCanvas = GameObject.Find("Canvas_stress");

        if (stressCanvas)
        {
            stressCanvas.SetActive(false);
        }

        GameObject emptyObject = GameObject.Find("dataSaver");

        dataSaverScript = emptyObject.GetComponent <dataSaver> ();
        if (dataSaverScript.getIsLastPractice())
        {
            timeLimit = int.MaxValue;
        }
        this.lslScript   = dataSaverScript.getLslScript();
        currentItemIndex = 0;

        findAllObjects();
        findAllComponents();

        this.sliderTemporalComponent.onValueChanged.AddListener(delegate {
            temporalValueChanged();
        });
        this.sliderPhysicalComponent.onValueChanged.AddListener(delegate {
            physicalValueChanged();
        });
        this.sliderMentalComponent.onValueChanged.AddListener(delegate {
            mentalValueChanged();
        });
        this.sliderEffortComponent.onValueChanged.AddListener(delegate {
            effortValueChanged();
        });
        this.sliderFrustrationComponent.onValueChanged.AddListener(delegate {
            frustrationValueChanged();
        });
        this.sliderPerformanceComponent.onValueChanged.AddListener(delegate {
            performaceValueChanged();
        });

        // paint in green the active slider (the first one), and the rest in black
        items = new Slider[] { sliderMentalComponent, sliderPhysicalComponent, sliderTemporalComponent,
                               sliderPerformanceComponent, sliderEffortComponent, sliderFrustrationComponent };
        int index = 0;

        for (index = 0; index < items.Length; index++)
        {
            UnityEngine.UI.Image[] images = items [index].GetComponentsInChildren <UnityEngine.UI.Image> ();
            for (int i = 0; i < images.Length; i++)
            {
                if (images [i].name == "Background")
                {
                    if (index == 0)
                    {
                        images [i].color = Color.green;
                    }
                    else
                    {
                        images [i].color = Color.black;
                    }
                }
            }
        }
        this.lslScript.setMarker("eval_start_1_load_1");

        this.startTime = Time.time;
    }