public void OnTriggerStay(Collider other) { if (leftController.controller.GetHairTriggerUp() || rightController.controller.GetHairTriggerUp()) { // check if the participant made an answer then move on to next trial if (ps.ChoiceMade()) { ps.IncTrial(); if (ps.IsFinished()) { SceneManager.LoadScene("FinalScene", LoadSceneMode.Single); } Debug.Log(string.Format("Starting trial {0} at {1}", ps.GetTrial(), Time.time)); } } }
public void Start() { ps = ParticipantStatus.GetInstance(); ps.IncTrial(); }
//called by buttons' OnClickButton public void Clicked(string clickedTag) { if (clickedTag == "NEXT") { if (ps.GetTrial() > 0 && !ps.ChoiceMade()) return; //Debug.Log("nex~~~~~"); //collect data if (ps.IsFinished()) { SceneManager.LoadScene("FinalScene", LoadSceneMode.Single); } Debug.Log("Incrementing Trial"); ps.IncTrial(); //Debug.Log(string.Format("Starting trial {0} at {1}", ps.GetTrial(), Time.time)); //Despawn current box this.GetComponent<DespawnObject>().buttonDespawn(); for (int i = 0; i < choices.Count; i++) { if (choices[i].GetComponent<CustomTag>().getTag(0) != "NEXT") { choices[i].GetComponent<Renderer>().material = noChoiceMat; } else { choices[i].GetComponent<Renderer>().material = neutralMat; } } //Spawn in new box this.GetComponent<SpawnRandomBox>().spawn(); firstChoice = true; } else { if (firstChoice == true) { //collect data if (ps.SetChoice(clickedTag)) { ps.GetDataFarmer().Save(new DFAnswerSelection()); //Debug.Log(string.Format("Answer selected: {0}", ps.GetLastChoice())); } firstChoice = false; GameObject[] currentObjs = GameObject.FindGameObjectsWithTag("Interactable Object"); foreach (GameObject cube in currentObjs) { string chosenTag = ParticipantStatus.GetInstance().GetCategory(); ParticipantStatus.GetInstance().SetChoice(chosenTag); if (chosenTag == clickedTag) { for (int i = 0; i < choices.Count; i++) { if (choices[i].GetComponent<CustomTag>().getTag(0) != "NEXT") { if (choices[i].GetComponent<CustomTag>().getTag(0) != chosenTag) { choices[i].GetComponent<Renderer>().material = neutralMat; } else { choices[i].GetComponent<Renderer>().material = correctMat; } } else { choices[i].GetComponent<Renderer>().material = nextMat; } } } else { for (int i = 0; i < choices.Count; i++) { if (choices[i].GetComponent<CustomTag>().getTag(0) != "NEXT") { if (choices[i].GetComponent<CustomTag>().getTag(0) != chosenTag) { choices[i].GetComponent<Renderer>().material = neutralMat; } else { choices[i].GetComponent<Renderer>().material = correctMat; } if (choices[i].GetComponent<CustomTag>().getTag(0) == clickedTag) { choices[i].GetComponent<Renderer>().material = wrongMat; } } else { choices[i].GetComponent<Renderer>().material = nextMat; } } } } } } }