// Update is called once per frame
 void Update()
 {
     if (phase == 0)
     {
         if (Input.GetKeyDown(KeyCode.N))
         {
             PracStartText.SetActive(false);
             OutputResult.output(0, 0);
             FixedCrossPart1.SetActive(true);
             FixedCrossPart2.SetActive(true);
             phase++;
         }
     }
     else if (phase == 1)
     {
         if (nowTrial != nPracTrials)
         {
             DoTrial();
         }
         else
         {
             FixedCrossPart1.SetActive(false);
             FixedCrossPart2.SetActive(false);
             AutoPusher.AKeyDown = false;
             StartText.SetActive(true);
             phase++;
         }
     }
     else if (phase == 2)
     {
         if (Input.GetKeyDown(KeyCode.N))
         {
             StartText.SetActive(false);
             FixedCrossPart1.SetActive(true);
             FixedCrossPart2.SetActive(true);
             phase++;
         }
     }
     else if (phase == 3)
     {
         if (nowTrial != nPracTrials + nTrials)
         {
             DoTrial();
         }
         else
         {
             FixedCrossPart1.SetActive(false);
             FixedCrossPart2.SetActive(false);
             EndText.SetActive(true);
             phase++;
         }
     }
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        SteamVR_TrackedObject trackedObject = GetComponent <SteamVR_TrackedObject>();
        var device = SteamVR_Controller.Input((int)trackedObject.index);

        if (ObjectMotion.phase == 0)
        {
            if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                Vector2 touchPosition = device.GetAxis();
                if (touchPosition.y > 0)
                {
                    Debug.Log("Press UP");
                }
                else if (touchPosition.y < 0)
                {
                    Debug.Log("Press DOWN");
                }
            }
            else if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger))
            {
                Debug.Log("Pull Trigger");
            }
        }
        if (ObjectMotion.SpaceKeyDown == true)
        {
            if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                Vector2 touchPosition = device.GetAxis();
                resp = true;
                ObjectMotion.SpaceKeyDown = false;
                if (touchPosition.y > 0)
                {
                    Debug.Log("Press UP");
                    OutputResult.output(1, 0);
                }
                else if (touchPosition.y < 0)
                {
                    Debug.Log("Press DOWN");
                    OutputResult.output(1, 1);
                }
            }
            else if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger))
            {
                resp = true;
                ObjectMotion.SpaceKeyDown = false;
                Debug.Log("Pull Trigger");
                OutputResult.output(1, -1);
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        SteamVR_TrackedObject trackedObject = GetComponent <SteamVR_TrackedObject>();
        var device = SteamVR_Controller.Input((int)trackedObject.index);

        if (Main.permitResp & Main.stage == 1)
        {
            if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger))
            {
                rightResp = true;
            }
        }
        else if (Main.permitResp & Main.stage == 2)
        {
            if (device.GetPress(SteamVR_Controller.ButtonMask.Touchpad))
            {
                Vector2 touchPosition = device.GetAxis();
                if (touchPosition.y > 0)
                {
                    RightBar.transform.RotateAround(new Vector3(0, Main.hight, Main.depth), Vector3.forward, changeAngleUnit);
                    if (Main.mode == 2)
                    {
                        LeftBar.transform.RotateAround(new Vector3(0, Main.hight, Main.depth), Vector3.forward, -changeAngleUnit);
                    }
                }
                else if (touchPosition.y < 0)
                {
                    RightBar.transform.RotateAround(new Vector3(0, Main.hight, Main.depth), Vector3.forward, -changeAngleUnit);
                    if (Main.mode == 2)
                    {
                        LeftBar.transform.RotateAround(new Vector3(0, Main.hight, Main.depth), Vector3.forward, changeAngleUnit);
                    }
                }
            }
            else if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger))
            {
                rightResp = true;
                OutputResult.output(Main.phase, Math.Round(LeftBar.transform.eulerAngles.z, 1), Math.Round(RightBar.transform.eulerAngles.z, 1));
            }
        }
    }
Beispiel #4
0
 // Update is called once per frame
 void Update()
 {
     if (phase == 0)
     {
         if (mode == 0 & Input.GetKeyDown(KeyCode.Alpha1))
         {
             mode = 1;
         }
         else if (mode == 0 & Input.GetKeyDown(KeyCode.Alpha2))
         {
             mode = 2;
         }
         else if (mode != 0)
         {
             ModeSelectText.SetActive(false);
             StartText.SetActive(true);
             OutputResult.output(phase, 0, 0);
             phase++;
         }
     }
     else if (phase == 1)
     {
         if (Timer.nowTime > ConsVelTime)
         {
             StartText.SetActive(false);
             phase++;
         }
     }
     else if (phase == 2)
     {
         if (nowTrial != nTrials)
         {
             DoTrial();
         }
         else
         {
             EndText.SetActive(true);
             phase++;
         }
     }
 }