예제 #1
0
        bool ProcessEventInMap(ActionMapInput map, InputEvent inputEvent)
        {
            if (map.ProcessEvent(inputEvent))
            {
                return(true);
            }

            if (map.CurrentlyUsesDevice(inputEvent.device))
            {
                return(false);
            }

            // If this event uses a different device than the current control scheme then try and initialize a control scheme that has that device.
            // Otherwise, leave the current current control scheme state alone as a re-initialization of the same control scheme will cause a reset in the process.
            if (!map.autoReinitialize || !map.TryInitializeWithDevices(GetApplicableDevices(), new List <InputDevice>()
            {
                inputEvent.device
            }))
            {
                return(false);
            }

            // When changing control scheme, we do not want to init control scheme to device states
            // like we normally want, so do a hard reset here, before processing the new event.
            map.Reset(false);

            return(map.ProcessEvent(inputEvent));
        }
예제 #2
0
 void Awake()
 {
     if (autoAssignGlobal)
     {
         handle        = PlayerHandleManager.GetNewPlayerHandle();
         handle.global = true;
         foreach (ActionMapSlot actionMapSlot in actionMaps)
         {
             ActionMapInput actionMapInput = ActionMapInput.Create(actionMapSlot.actionMap);
             actionMapInput.TryInitializeWithDevices(handle.GetApplicableDevices());
             actionMapInput.active          = actionMapSlot.active;
             actionMapInput.blockSubsequent = actionMapSlot.blockSubsequent;
             handle.maps.Add(actionMapInput);
         }
     }
 }
예제 #3
0
        bool ProcessEventInMap(ActionMapInput map, InputEvent inputEvent)
        {
            if (map.ProcessEvent(inputEvent))
            {
                return(true);
            }

            if (map.CurrentlyUsesDevice(inputEvent.device))
            {
                return(false);
            }

            if (!map.TryInitializeWithDevices(GetApplicableDevices()))
            {
                return(false);
            }

            // When changing control scheme, we do not want to init control scheme to device states
            // like we normally want, so do a hard reset here, before processing the new event.
            map.Reset(false);

            return(map.ProcessEvent(inputEvent));
        }