void Update() { // If we are in a practice block - we wait until space is pressed if (dataSaverScript.getIsLastPractice()) { if (Input.GetKeyDown(KeyCode.Space)) { SceneManager.LoadScene("load_evaluation"); return; } } // check if time limit has passed float currrentTime = Time.time; if (currrentTime - this.startTime > this.timeLimit) { this.onDone(); } if (Input.anyKeyDown) { // key is down so we need to make the next scale active (paint the next scale in green) this.updateActiveScale(); } // If get here if no key was pressed, so we check for change in joystick horizontal axis var movement = Input.GetAxis("Horizontal"); if (currentItemIndex < itemsNumber) { items[currentItemIndex].value += movement / 8; // we devide the movement by 8 to make the movement more delecate } }
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; }