예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (controller.GetButtonDown(GvrControllerButton.App))
        {
            timer = 0;
        }

        else if (controller.GetButton(GvrControllerButton.App))
        {
            timer += Time.deltaTime;
            if (timer >= APP_LONG_PRESS_DURATION && !actionComplete)
            {
                // Do "long press" actions here
                menuActive = !menuActive;
                menu.transform.position = camera.transform.position + camera.transform.forward * 0.75f;
                menu.transform.rotation = camera.transform.rotation;
                menu.SetActive(menuActive);
                actionComplete = true;
            }
        }

        else if (controller.GetButtonUp(GvrControllerButton.App))
        {
            actionComplete = false;
        }
    }
 private void Update()
 {
     foreach (var hand in Gvr.Internal.ControllerUtils.AllHands)
     {
         GvrControllerInputDevice device = GvrControllerInput.GetDevice(hand);
         if (device.GetButtonUp(GvrControllerButton.App))
         {
             CycleSeeThroughModes();
         }
     }
 }
예제 #3
0
        /// Returns true the frame after the user stops pressing down any of buttons specified
        /// in `buttons` on any controller.
        public static bool AnyButtonUp(GvrControllerButton buttons)
        {
            bool ret = false;

            foreach (var hand in AllHands)
            {
                GvrControllerInputDevice device = GvrControllerInput.GetDevice(hand);
                ret |= device.GetButtonUp(buttons);
            }
            return(ret);
        }
예제 #4
0
    private void Teleport(GvrControllerInputDevice device)
    {
        if (device.GetButtonUp(GvrControllerButton.TouchPadButton) &&
            GvrLaserPointer.CurrentRaycastResult.gameObject != null &&
            (GvrLaserPointer.CurrentRaycastResult.gameObject.tag == TELEPORT_CAPABLE_TAG ||
             (GvrLaserPointer.CurrentRaycastResult.gameObject.tag == SWIM_LANE_TAG &&
              !BoardManager.AnyCardsSelected())))
        {
            transform.position = GvrLaserPointer.CurrentRaycastResult.worldPosition + new Vector3(0, 1.5f, 0);

            networkManager.RaiseEvent(NetworkManager.EventCode.PlayerPositionChanged, transform.position);
        }
    }
예제 #5
0
 public override void OnUpdate(GameController gameController)
 {
     if (controller.GetButtonDown(GvrControllerButton.TouchPadButton))
     {
         downTime = Time.time;
     }
     if (controller.GetButtonUp(GvrControllerButton.TouchPadButton))
     {
         if ((Time.time - downTime) < 1.0f)
         {
             gameController.GoToNextHole();
         }
     }
 }
예제 #6
0
 public override void OnUpdate(GameController gameController)
 {
     if (controller.GetButtonDown(GvrControllerButton.TouchPadButton))
     {
         downTime = Time.time;
     }
     if (controller.GetButtonUp(GvrControllerButton.TouchPadButton))
     {
         if ((Time.time - downTime) < 1.0f)
         {
             gameController.SetState(State.PRE_THROW);
         }
     }
 }
예제 #7
0
 public override void OnUpdate(GameController gameController)
 {
     if (controller.GetButtonDown(GvrControllerButton.TouchPadButton))
     {
         downTime = Time.time;
     }
     if (controller.GetButtonUp(GvrControllerButton.TouchPadButton))
     {
         if ((Time.time - downTime) < 1.0f)
         {
             Vector3 position = gameController.GetDisc().transform.position;
             gameController.MovePlayerToDiscPosition(position);
             gameController.SetState(State.PRE_THROW);
         }
     }
 }
예제 #8
0
 public override void OnUpdate(GameController gameController)
 {
     if (controller.GetButton(GvrControllerButton.TouchPadButton))
     {
         throwController.UpdateDiscVelocity(controller);
     }
     else if (controller.GetButtonUp(GvrControllerButton.TouchPadButton))
     {
         if (throwController.ReleaseDisc(controller))
         {
             gameController.SetState(State.DISC_IN_PLAY);
         }
         else
         {
             gameController.SetState(State.PRE_THROW);
         }
     }
 }
예제 #9
0
    // Update is called once per frame
    void Update()
    {
        if (_pointingAt)
        {
            // While touching the pad pan the map
            if (_dominantController.GetButton(GvrControllerButton.TouchPadTouch))
            {
                Vector2 touchPos = _dominantController.TouchPos;

                if (_previousTouchState)
                {
                    _translate = new Vector3();
                    Vector2 orientationDelta = touchPos - _previousTouch;

                    _translate.x += orientationDelta.x * panFactor;
                    _translate.z += orientationDelta.y * panFactor;

                    this.transform.Translate(_translate);
                }
                _previousTouchState = true;
                _previousTouch      = touchPos;
            }
            // When the pad is let go recenter the map
            if (_dominantController.GetButtonUp(GvrControllerButton.TouchPadTouch))
            {
                Recenter();
                _previousTouch      = _dominantController.TouchPos;
                _previousTouchState = false;
            }
            // When the button is clicked zoom in
            if (_dominantController.GetButtonDown(GvrControllerButton.TouchPadButton)) // Using event instead
            {
            }
            // When the app button is clicked zoom out
            if (_dominantController.GetButtonDown(GvrControllerButton.App)) // TODO: Change to double click
            {
                ZoomOut();
            }
        }

        CullSiteMarkers();
    }
예제 #10
0
        protected virtual void Update()
        {
            if (GvrControllerInput.TouchDown)
            {
                initTouch = GvrControllerInput.TouchPos;
            }
            else if (CanStartMoving())
            {
                isMoving    = true;
                smoothTouch = Vector2.zero;
                vignetteController.ShowVignette();
            }
            else if (GvrControllerInput.TouchUp)
            {
                StopMoving();
            }

            if (isMoving)
            {
                if (walkToggle.isOn && DaydreamControllerInput.GetButtonUp(GvrControllerButton.TouchPadButton))
                {
                    isWalking = !isWalking;
                    // if walking, max speed is lower
                    maxSpeed = isWalking ? 100f : 300f;
                    //if walking, running panel is off
                    if (isWalking)
                    {
                        running_panel.SetActive(false);
                    }
                    else
                    {
                        running_panel.SetActive(true);
                    }
                }
                Move();
            }
        }