public static bool IsKeyPressed(InputCommand inputCommand) { if (_keyBindings == null) { _keyBindings = new ControlMapping().LoadKeyBindings(); } // This weird 'new' statement prevents the one-use method LoadKeyBindings from being held in memory. if(!_keyBindings.ContainsKey(inputCommand)) { throw new Exception("No key binding found for input command: " + inputCommand.ToString()); } foreach(Keys key in _keyBindings[inputCommand]) { if (_input.Keyboard.IsKeyPressed(key)) { return true; } } return false; }