protected void SetEvent(IInputAction action, InputEventType eventType, InputEventHandleAction handleAction, IInputHandler handler) { switch (eventType) { case InputEventType.KeyUp: if (handleAction == InputEventHandleAction.Add) { action.KeyUp += handler.HandleInput; } else { action.KeyUp -= handler.HandleInput; } break; case InputEventType.KeyDown: if (handleAction == InputEventHandleAction.Add) { action.KeyDown += handler.HandleInput; } else { action.KeyDown -= handler.HandleInput; } break; } }
protected void SetEvent(string mapName, IInputHandler handler, InputEventHandleAction handleAction) { if (actionMaps.ContainsKey(mapName)) { foreach (IInputAction action in actionMaps[mapName]) { SetEvent(action, InputEventType.KeyUp, handleAction, handler); } } }
protected void SetEvent(string mapName, string actionName, IInputHandler handler, InputEventHandleAction handleAction) { if (actionMaps.ContainsKey(mapName) && actionMaps[mapName].ContainsAction(actionName)) { SetEvent(actionMaps[mapName].GetAction(actionName), InputEventType.KeyUp, handleAction, handler); } }