示例#1
0
        public void Init(SaberType type, VRControllersInputManager vrControllersInputManager)
        {
            OVRInput.Controller oculusController;
            XRNode node;

            if (type == SaberType.SaberA)
            {
                oculusController = OVRInput.Controller.LTouch;
                node             = XRNode.LeftHand;
            }
            else
            {
                oculusController = OVRInput.Controller.RTouch;
                node             = XRNode.RightHand;
            }

            var controllerInputDevice = InputDevices.GetDeviceAtXRNode(node);

            var vrSystem = OVRInput.IsControllerConnected(oculusController) ? VRSystem.Oculus : VRSystem.SteamVR;

            var dir = _config.ThumstickDirection;

            var triggerHandler = new TriggerHandler(node, _config.TriggerThreshold, _config.ReverseTrigger);
            var gripHandler    = new GripHandler(vrSystem, oculusController, controllerInputDevice,
                                                 _config.GripThreshold, _config.ReverseGrip);
            var thumbstickAction = new ThumbstickHandler(node, _config.ThumbstickThreshold, dir, _config.ReverseThumbstick);

            _trickInputHandler.Add(_config.TriggerAction, triggerHandler);
            _trickInputHandler.Add(_config.GripAction, gripHandler);
            _trickInputHandler.Add(_config.ThumbstickAction, thumbstickAction);

            _logger.Debug("Started Input Manager using " + vrSystem);
        }
示例#2
0
        public void Init(SaberType type, VRControllersInputManager vrControllersInputManager)
        {
            OVRInput.Controller oculusController;
            XRNode node;

            if (type == SaberType.SaberA)
            {
                oculusController = OVRInput.Controller.LTouch;
                node             = XRNode.LeftHand;
            }
            else
            {
                oculusController = OVRInput.Controller.RTouch;
                node             = XRNode.RightHand;
            }

            var controllerInputDevice = InputDevices.GetDeviceAtXRNode(node);

            var vrSystem = OVRInput.IsControllerConnected(oculusController) ? VRSystem.Oculus : VRSystem.SteamVR;

            var dir = (ThumstickDir)Enum.Parse(typeof(ThumstickDir), PluginConfig.Instance.ThumstickDirection, true);

            var triggerHandler = new TriggerHandler(node, PluginConfig.Instance.TriggerThreshold);
            var gripHandler    = new GripHandler(vrSystem, oculusController, controllerInputDevice,
                                                 PluginConfig.Instance.GripThreshold);
            var thumbstickAction = new ThumbstickHandler(node, PluginConfig.Instance.ThumbstickThreshold, dir);

            _trickInputHandler.Add(PluginConfig.Instance.TriggerAction.GetEnumValue <TrickAction>(), triggerHandler);
            _trickInputHandler.Add(PluginConfig.Instance.GripAction.GetEnumValue <TrickAction>(), gripHandler);
            _trickInputHandler.Add(PluginConfig.Instance.ThumbstickAction.GetEnumValue <TrickAction>(),
                                   thumbstickAction);

            Plugin.Log.Debug("Started Input Manager using " + vrSystem);
        }