public void Update(GameTime gameTime) { if (_keyboardMappings != null || _buttonMappings != null) { var firePressed = false; if (_keyboardMappings != null) { var pressed = _keyboardInput.PressedKeys; Array.ForEach(_movementComponent, movement => movement.InputDirection = InputHelper.DirectionFromMapping(pressed, _keyboardMappings)); firePressed = pressed.Any(k => k == Keys.Space); } else if (_buttonMappings != null) { var pressed = _buttonInput.ButtonsPressed; Array.ForEach(_movementComponent, movement => movement.InputDirection = InputHelper.DirectionFromMapping(pressed, _buttonMappings)); } _elapsedTimeMilliseconds += gameTime.ElapsedGameTime.TotalMilliseconds; if (firePressed && _elapsedTimeMilliseconds > GameConstants.RepeaterDelay) { _elapsedTimeMilliseconds = 0; Owner.Event(ObjectEvent.Fire); } } }