コード例 #1
0
        public OpenVRInputObservable(CVRSystem hmd)
        {
            this.hmd = hmd;

            var eventLauncher = new OpenVREventLauncher(hmd);

            InputEvents =
                from evt in Observable.FromEventPattern<OpenVREventArgs>(eventLauncher, nameof(eventLauncher.OpenVREvent))
                let evtType = evt.EventArgs.EventType
                let data = evt.EventArgs.EventData
                where ControllerEvents.Contains(evtType)
                where evtType == EVREventType.VREvent_ButtonPress || evtType == EVREventType.VREvent_ButtonUnpress
                select new OpenVRControllerInput(hmd, evt.EventArgs.DeviceIndex, evtType, data.controller);            
        }