Пример #1
0
    // 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();
            }
        }
    }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     networkControlCenter.Update(currentTrial);
     if (currentTrial != myTrials.GetOrderIndex())
     {
         currentTrial = myTrials.GetOrderIndex();
         InputField trial = inputField.GetComponent <InputField> ();
         trial.text = myTrials.GetOrderIndex().ToString();
     }
 }
Пример #3
0
 public void SendClientUpdate()
 {
     Debug.Log("Sent Data to Server");
     myClient.Send(STATE_DATA, new ExperimentalState(parent.transform.position, parent.transform.eulerAngles, trialManager.GetOrderIndex()));
 }