示例#1
0
            public void Init(SteamVRControllerEventComponent monoBehaviour)
            {
                _eventComponent = monoBehaviour;

                _eventComponent.ControllerEnabled += (sender, args) => { ControllerEnabled?.Invoke(sender, args); };

                _eventComponent.ControllerDisabled += (sender, args) => { ControllerDisabled?.Invoke(sender, args); };

                _eventComponent.TriggerPressed += (sender, args) => { TriggerPressed?.Invoke(sender, args); };

                _eventComponent.TriggerReleased += (sender, args) => { TriggerReleased?.Invoke(sender, args); };

                _eventComponent.TouchpadReleased += (sender, args) => { TouchpadReleased?.Invoke(sender, args); };

                _eventComponent.TouchpadPressed += (sender, args) => { TouchpadPressed?.Invoke(sender, args); };

                _eventComponent.ButtonTwoPressed += (sender, args) => { ButtonTwoPressed?.Invoke(sender, args); };

                _eventComponent.ButtonTwoReleased += (sender, args) => { ButtonTwoReleased?.Invoke(sender, args); };

                _eventComponent.GripPressed += (sender, args) => { GripPressed?.Invoke(sender, args); };

                _eventComponent.TurnLeftPressed += (sender, args) => { TurnLeftPressed?.Invoke(sender, args); };

                _eventComponent.TurnRightPressed += (sender, args) => { TurnRightPressed?.Invoke(sender, args); };

                InputAdapter.Instance.ControllerInput.AddController(this);
            }
    private void MenuPressUp(SteamVR_Behaviour_Boolean behaviour, SteamVR_Input_Sources sources, bool state)
    {
        Debug.Log("called menu press up " + sources);

        ButtonTwoReleased?.Invoke(this,
                                  new ControllerInput.ControllerInteractionEventArgs
        {
            controllerReference =
                new PlayerController.ControllerReferenceArgs {
                hand = sources.SteamSourceToHand()
            }
        });
    }
示例#3
0
        public override void AddController(ControllerEvents events)
        {
            if (_controllerEvents.Contains(events.gameObject))
            {
                return;
            }

            _controllerEvents.Add(events.gameObject);

            events.ControllerEnabled += (sender, args) => { ControllerEnabled?.Invoke(sender, args); };

            events.ControllerDisabled += (sender, args) => { ControllerDisabled?.Invoke(sender, args); };

            events.TriggerReleased += (sender, args) => { TriggerReleased?.Invoke(sender, args); };

            events.TriggerPressed += (sender, args) => { TriggerPressed?.Invoke(sender, args); };

            events.TouchpadReleased += (sender, args) => { TouchpadReleased?.Invoke(sender, args); };

            events.TouchpadPressed += (sender, args) => { TouchpadPressed?.Invoke(sender, args); };

            events.ButtonTwoPressed += (sender, args) => { ButtonTwoPressed?.Invoke(sender, args); };

            events.ButtonTwoReleased += (sender, args) => { ButtonTwoReleased?.Invoke(sender, args); };

            events.GripPressed += (sender, args) => { GripPressed?.Invoke(sender, args); };

            ((SteamVRControllerEvents)events).TurnLeftPressed += (sender, args) =>
            {
                TurnLeftPressed?.Invoke(sender, args);
            };

            ((SteamVRControllerEvents)events).TurnRightPressed += (sender, args) =>
            {
                TurnRightPressed?.Invoke(sender, args);
            };
        }