Example #1
0
        private void DetectInputs(out bool actionTeleportation, out bool shiftLeft, out bool shiftRight, out bool actionInteract, out bool actionRelease)
        {
            actionTeleportation = false;
            shiftLeft           = false;
            shiftRight          = false;
            actionInteract      = false;
            actionRelease       = false;

            /* check whether we prefer to use a touchpad or joystick with current controller configuration */
            if (useTouchpadInsteadOfJoystick)
            {
                DetectTouchpadInputs(out actionTeleportation, out shiftLeft, out shiftRight);
            }
            else
            {
                DetectJoystickInputs(out actionTeleportation, out shiftLeft, out shiftRight);
            }

            /* trigger is pressed -> interact with object */
            //if(TBInput.GetButtonDown(TBInput.Button.PrimaryTrigger, controller)) {
            if (TBInput.GetAxis1D(TBInput.Button.PrimaryTrigger, controller) > triggerThreshold && !triggerPushed)
            {
                triggerPushed  = true;
                actionInteract = true;
            }

            /* trigger is released -> release object */
            //if(TBInput.GetButtonUp(TBInput.Button.PrimaryTrigger, controller)) {
            if (TBInput.GetAxis1D(TBInput.Button.PrimaryTrigger, controller) < triggerThreshold && triggerPushed)
            {
                triggerPushed = false;
                actionRelease = true;
            }
        }
Example #2
0
        private void AnimateControllerModel()
        {
            if (TBInput.GetAxis1D(TBInput.Button.PrimaryTrigger, controller) > triggerThreshold)
            {
                triggerRepresentation.transform.localRotation = Quaternion.Euler(-10.0f, -180.0f, 0.0f);
            }
            else
            {
                triggerRepresentation.transform.localRotation = Quaternion.Euler(10.0f, -180.0f, 0.0f);
            }

            Vector2 joyPos = TBInput.GetAxis2D(TBInput.Button.Joystick, controller);

            analogRepresentation.transform.localRotation = Quaternion.Euler(-joyPos.y * 30.0f, 180.0f, joyPos.x * 30.0f);
        }
Example #3
0
 private void Update()
 {
     _image.fillAmount = TBInput.GetAxis1D(_button, _controller);
 }