/// <summary> /// Generates new game from given settings. /// </summary> /// <param name="model">Model containing game settings.</param> /// <returns>Generated game.</returns> private Game GenerateNewGame(NewGameSettingsModel model) { string playerName = model.PlayerName; Game game; if (rbRandomMap.IsChecked.HasValue && rbRandomMap.IsChecked.Value == true) { int w = model.MapWidth; int h = model.MapHeight; int seed = model.MapSeed; int aiCount = model.AiCount; double monsterDensity = model.NormalizedMonsterDensity; double itemDensity = model.NormalizedItemDensity; game = GameGenerator.GenerateGame(w, h, seed, aiCount, monsterDensity, itemDensity, playerName); } else if (rbImportedMap.IsChecked.HasValue && rbImportedMap.IsChecked.Value == true) { game = GameGenerator.GenerateGame(model.SelectedImportedMap.Map, playerName); } else { throw new Exception("Nebyla vybrána žádná volba nastavení mapy!"); } return(game); }