private void AnimateInput(ref float time, TBInput.Controller controller)
 {
     if (TBInput.GetButton(TBInput.Button.Any, controller))
     {
         AddTime(ref time);
     }
     else
     {
         ResolveTime(ref time);
     }
 }
Пример #2
0
 private void Update()
 {
     if (TBInput.GetButton(_button, _controller))
     {
         _image.color = Color.green;
     }
     else
     {
         _image.color = Color.white;
     }
 }
Пример #3
0
        private void DetectTouchpadInputs(out bool actionTeleportation, out bool shiftLeft, out bool shiftRight)
        {
            actionTeleportation = false;
            shiftLeft           = false;
            shiftRight          = false;

            /* on touch start, note current touch position and prepare for shift */
            Vector2 touchpadPosition = TBInput.GetAxis2D(TBInput.Button.Touchpad, controller);

            if (TBInput.GetTouchDown(TBInput.Button.Action1, controller))
            {
                touchpadPrepareForShift      = true;
                touchpadPositionOnTouchStart = touchpadPosition;
            }
            /* on touchpad release, check whether shift flag is still up and whether minimum threshold is met */
            else if (TBInput.GetTouchUp(TBInput.Button.Action1, controller) && touchpadPrepareForShift)
            {
                touchpadPrepareForShift = false;
                if (Mathf.Abs(touchpadPosition.x - touchpadPositionOnTouchStart.x) > touchpadSwipeThreshold)
                {
                    if (touchpadPosition.x < touchpadPositionOnTouchStart.x)
                    {
                        shiftLeft = true;
                    }
                    else
                    {
                        shiftRight = true;
                    }
                }
            }
            /* when button is clicked, initiate teleport and cancel shift */
            if (TBInput.GetButton(TBInput.Button.Action1, controller))
            {
                touchpadPrepareForShift = false;
                actionTeleportation     = true;
            }
        }
        private void AnimateHandControllers()
        {
            bool leftController  = false;
            bool rightController = false;

            if (TBInput.GetButton(TBInput.Button.Any, TBInput.Controller.RHandController))
            {
                rightController = true;
            }

            if (TBInput.GetButton(TBInput.Button.Any, TBInput.Controller.LHandController))
            {
                leftController = true;
            }

            if (rightController || leftController)
            {
                AddTime(ref _selectionVal);
            }
            else
            {
                ResolveTime(ref _selectionVal);
            }
        }