Ejemplo n.º 1
0
        protected void UpdateButtonStates()
        {
            for (int index = 0; index < NVRButtonsHelper.Array.Length; index++)
            {
                NVRButtons      nvrbutton = NVRButtonsHelper.Array[index];
                NVRButtonInputs button    = Inputs[nvrbutton];
                button.Axis          = InputDevice.GetAxis2D(nvrbutton);
                button.SingleAxis    = InputDevice.GetAxis1D(nvrbutton);
                button.PressDown     = InputDevice.GetPressDown(nvrbutton);
                button.PressUp       = InputDevice.GetPressUp(nvrbutton);
                button.IsPressed     = InputDevice.GetPress(nvrbutton);
                button.TouchDown     = InputDevice.GetTouchDown(nvrbutton);
                button.TouchUp       = InputDevice.GetTouchUp(nvrbutton);
                button.IsTouched     = InputDevice.GetTouch(nvrbutton);
                button.NearTouchDown = InputDevice.GetNearTouchDown(nvrbutton);
                button.NearTouchUp   = InputDevice.GetNearTouchUp(nvrbutton);
                button.IsNearTouched = InputDevice.GetNearTouch(nvrbutton);
            }

            HoldButtonPressed = Inputs[HoldButton].IsPressed;
            HoldButtonDown    = Inputs[HoldButton].PressDown;
            HoldButtonUp      = Inputs[HoldButton].PressUp;
            HoldButtonAxis    = Inputs[HoldButton].SingleAxis;

            UseButtonPressed = Inputs[UseButton].IsPressed;
            UseButtonDown    = Inputs[UseButton].PressDown;
            UseButtonUp      = Inputs[UseButton].PressUp;
            UseButtonAxis    = Inputs[UseButton].SingleAxis;
        }
Ejemplo n.º 2
0
        protected virtual void FixedUpdate()
        {
            if (CurrentHandState == HandState.Uninitialized)
            {
                return;
            }

            LastPositions[EstimationSampleIndex] = this.transform.position;
            LastRotations[EstimationSampleIndex] = this.transform.rotation;
            LastDeltas[EstimationSampleIndex]    = Time.deltaTime;
            EstimationSampleIndex++;

            if (EstimationSampleIndex >= LastPositions.Length)
            {
                EstimationSampleIndex = 0;
            }
            if (InputDevice != null && InputDevice.GetTouch(NVRButtons.Trigger))
            {
                InputDevice.TriggerHapticPulse(100);
            }

            if (InputDevice != null && IsInteracting == false)
            {
                if ((IsHovering == true && Player.VibrateOnHover == true) || IsShaking == true)
                {
                    InputDevice.TriggerHapticPulse(amplitude);
                }
            }

            if (_LastShakeTime + 1 < Time.time)
            {
                EndShake();
            }
        }