// Update is called once per frame void Update() { networkControlCenter.Update(myTrials.GetOrderIndex()); if (state == PRETEST) { if ((Input.GetMouseButton(0) || AccelerometerInput4.advanceState) && Time.fixedTime > lastButtonPress + 1) { lastButtonPress = Time.fixedTime; ResetPerson(); state = PRETRIAL; AccelerometerInput4.advanceState = !AccelerometerInput4.advanceState; } } else if (state == PRETRIAL) { if ((Input.GetMouseButton(0) || AccelerometerInput4.advanceState) && Time.fixedTime > lastButtonPress + 1) { if (Mathf.Abs(_humanMover.transform.position.x - myTrials.GetTrial().startObject.transform.position.x) < 1.2) { if (Mathf.Abs(_humanMover.transform.position.z - myTrials.GetTrial().startObject.transform.position.z) < 1.2) { lastButtonPress = Time.fixedTime; state = INTRIAL; AccelerometerInput4.advanceState = !AccelerometerInput4.advanceState; StartTrial(); } } } } else if (state == INTRIAL) { if ((Input.GetMouseButton(0) || AccelerometerInput4.advanceState) && Time.fixedTime > lastButtonPress + 1) { lastButtonPress = Time.fixedTime; state = POSTTRIAL; AccelerometerInput4.advanceState = !AccelerometerInput4.advanceState; UserEndTrial(); _trial++; } if (Time.fixedTime > lastButtonPress + 3) { _textMessage.SetActive(false); } } else if (state == POSTTRIAL) { if ((Input.GetMouseButton(0) || AccelerometerInput4.advanceState) && Time.fixedTime > lastButtonPress + 1) { lastButtonPress = Time.fixedTime; state = PRETRIAL; AccelerometerInput4.advanceState = !AccelerometerInput4.advanceState; myTrials.MoveToNextTrial(); ResetPerson(); //networkControlCenter.SendStateUpdate (); networkControlCenter.SendStateUpdateUDP(); } } }
public void UpdateTrial() { InputField trial = inputField.GetComponent <InputField> (); myTrials.SetOrderIndex(int.Parse(trial.text)); //networkControlCenter.SendClientUpdate (); networkControlCenter.SendStateUpdateUDP(); }