示例#1
0
        internal override void UpdateValues(CustomController vrControllers)
        {
            bool state = UnityInputHelper.GetJoystickButtonValueByJoystickIndex(joystickID, inputIndex);

            bool isReleasing = false;

            if (state != lastState)
            {
                lastChangeTime = Time.realtimeSinceStartup;
                lastState      = state;
            }

            float timeSinceLastChange = Time.realtimeSinceStartup - lastChangeTime;

            if (state)
            {
                canRelease = timeSinceLastChange < 0.4f;
            }
            else
            {
                isReleasing = canRelease && timeSinceLastChange < 0.1f;
            }

            if (state)
            {
                vrControllers.SetButtonValueById(inputIDs[0], state);
            }

            if (isReleasing)
            {
                vrControllers.SetButtonValueById(inputIDs[1], isReleasing);
            }
        }
示例#2
0
        internal override void UpdateValues(CustomController vrControllers)
        {
            bool value = UnityInputHelper.GetJoystickButtonValueByJoystickIndex(joystickID, inputIndex);

            if (!value)
            {
                return;
            }

            foreach (int inputID in inputIDs)
            {
                vrControllers.SetButtonValueById(inputID, value);
            }
        }