Ejemplo n.º 1
0
        public bool MapVrTouch(VrInput input)
        {
            switch (input)
            {
            case VrInput.Directional:
            case VrInput.Thumbstick:
                return(controller.GetAxis2D(WebXRController.Axis2DTypes.Thumbstick) != Vector2.zero);

            case VrInput.Touchpad:
                return(controller.GetAxis2D(WebXRController.Axis2DTypes.Touchpad) != Vector2.zero);

            case VrInput.Button01:
            case VrInput.Button04:
            case VrInput.Button06:
                // Pad_Left, Pad_Down, Full pad, (X,A)
                return(controller.GetButton(WebXRController.ButtonTypes.ButtonA));

            case VrInput.Button02:
            case VrInput.Button03:
            case VrInput.Button05:
                // Pad_Right, Pad_Up, Application button, (Y,B)
                return(controller.GetButton(WebXRController.ButtonTypes.ButtonB));

            case VrInput.Any:     // Adjust this later
                return(true);

            default:
                Debug.Log("This shouldn't have happened! Bad input enum " + input.ToString());
                throw new System.NotImplementedException();     // Ask De-Panther about adding a WebXRController.ButtonTypes.None
            }
        }
    void UpdateController()
    {
        if (!controller.isControllerActive)
        {
            teleporter.ToggleDisplay(false);
            return;
        }

        Vector2 thumbstick = controller.GetAxis2D(WebXRController.Axis2DTypes.Thumbstick);
        Vector2 touchpad   = controller.GetAxis2D(WebXRController.Axis2DTypes.Touchpad);

        teleporter.ToggleDisplay(thumbstick.y > 0 || touchpad.y > 0);

        if (controller.GetButtonUp(WebXRController.ButtonTypes.Thumbstick) && thumbstick.y > 0)
        {
            teleporter.Teleport();
        }

        if (controller.GetButtonUp(WebXRController.ButtonTypes.Touchpad) && touchpad.y > 0)
        {
            teleporter.Teleport();
        }
    }
Ejemplo n.º 3
0
 public override Vector2 GetPadValue()
 {
     return(controller.GetAxis2D(WebXRController.Axis2DTypes.Touchpad));
 }