/// <summary> /// Changes game mode to the specified one. /// </summary> /// <param name="command">The Mode command.</param> private void ChangeGameMode(Command command) { var modeNameArgument = command.GetArgument <string>(0); var modeNameParseResult = Enum.TryParse(modeNameArgument, true, out GameModeType modeType); if (!modeNameParseResult) { _consoleManager.WriteLine($"$rInvalid mode type ($R{modeNameArgument}$r)"); return; } _commandsManager.RemoveCommandHandlers(CommandGroup.GameMode); _mode = _modeFactory.Create(modeType); _mode.LoadContent(Content); }