Esempio n. 1
0
    private void Update()
    {
        var rightHand = VRTK_SDK_Bridge.GetControllerRightHand();

        controllerIndex = VRTK_DeviceFinder.GetControllerIndex(rightHand);
        if (ForwardPressed() || Input.GetKeyUp(KeyCode.Space))
        {
            var nextSceneIndex = SceneManager.GetActiveScene().buildIndex + 1;
            if (nextSceneIndex >= SceneManager.sceneCountInBuildSettings)
            {
                nextSceneIndex = 0;
            }
            SceneManager.LoadScene(nextSceneIndex);
        }

        if (BackPressed() || Input.GetKeyUp(KeyCode.Backspace))
        {
            var previousSceneIndex = SceneManager.GetActiveScene().buildIndex - 1;
            if (previousSceneIndex < 0)
            {
                previousSceneIndex = SceneManager.sceneCountInBuildSettings - 1;
            }
            SceneManager.LoadScene(previousSceneIndex);
        }
    }
Esempio n. 2
0
 private bool NoArrowNotched(GameObject controller)
 {
     if (VRTK_SDK_Bridge.IsControllerLeftHand(controller))
     {
         bow = VRTK_SDK_Bridge.GetControllerRightHand().GetComponentInChildren <BowAim>();
     }
     else if (VRTK_SDK_Bridge.IsControllerRightHand(controller))
     {
         bow = VRTK_SDK_Bridge.GetControllerLeftHand().GetComponentInChildren <BowAim>();
     }
     return(bow == null || !bow.HasArrow());
 }
Esempio n. 3
0
 void Update()
 {
     if (hand == ControllerIndex.Left)
     {
         rb.MovePosition(VRTK_SDK_Bridge.GetControllerLeftHand().transform.position);
         rb.MoveRotation(VRTK_SDK_Bridge.GetControllerLeftHand().transform.rotation);
     }
     else if (hand == ControllerIndex.Right)
     {
         rb.MovePosition(VRTK_SDK_Bridge.GetControllerRightHand().transform.position);
         rb.MoveRotation(VRTK_SDK_Bridge.GetControllerRightHand().transform.rotation);
     }
 }
Esempio n. 4
0
    protected override void OnAwake()
    {
        base.OnAwake();
        _bagModule = ModuleManager.Instance.Get <BagModule>();
        int count = _bagModule.GetBagSize();

        _totalPage             = count / 9 + 1;
        _gridLayoutGroup       = transform.Find("Mask/GridLayoutGroup");
        _hintLayoutGroup       = transform.Find("Hint");
        _tipsTrans             = transform.Find("Tips");
        _vrToggleGroup         = _hintLayoutGroup.GetComponent <VRToggleGroup>();
        _leftControllerEvents  = VRTK_SDK_Bridge.GetControllerLeftHand(false).GetComponent <VRTK_ControllerEvents>();
        _rightControllerEvents = VRTK_SDK_Bridge.GetControllerRightHand(false).GetComponent <VRTK_ControllerEvents>();
    }
    private void Update()
    {
        if (!initalised)
        {
            var headset = VRTK_DeviceFinder.HeadsetTransform();
            if (!headset.GetComponent <VRTK_BezierPointer>())
            {
                var pointer = headset.gameObject.AddComponent <VRTK_BezierPointer>();

                pointer.controller          = VRTK_SDK_Bridge.GetControllerRightHand().GetComponent <VRTK_ControllerEvents>();
                pointer.showPlayAreaCursor  = true;
                pointer.pointerVisibility   = VRTK_WorldPointer.pointerVisibilityStates.Always_Off;
                pointer.pointerLength       = 7f;
                pointer.pointerDensity      = 1;
                pointer.pointerCursorRadius = 0.3f;
                pointer.beamCurveOffset     = 1f;
            }
            initalised = true;
        }
    }
Esempio n. 6
0
    private void DoObjectGrab(object sender, InteractableObjectEventArgs e)
    {
        if (VRTK_SDK_Bridge.IsControllerLeftHand(e.interactingObject))
        {
            holdControl   = VRTK_SDK_Bridge.GetControllerLeftHand().GetComponent <VRTK_ControllerEvents>();
            stringControl = VRTK_SDK_Bridge.GetControllerRightHand().GetComponent <VRTK_ControllerEvents>();

            holdActions   = VRTK_SDK_Bridge.GetControllerLeftHand().GetComponent <VRTK_ControllerActions>();
            stringActions = VRTK_SDK_Bridge.GetControllerRightHand().GetComponent <VRTK_ControllerActions>();
        }
        else
        {
            stringControl = VRTK_SDK_Bridge.GetControllerLeftHand().GetComponent <VRTK_ControllerEvents>();
            holdControl   = VRTK_SDK_Bridge.GetControllerRightHand().GetComponent <VRTK_ControllerEvents>();

            stringActions = VRTK_SDK_Bridge.GetControllerLeftHand().GetComponent <VRTK_ControllerActions>();
            holdActions   = VRTK_SDK_Bridge.GetControllerRightHand().GetComponent <VRTK_ControllerActions>();
        }
        StartCoroutine("GetBaseRotation");
    }