/// <summary> /// Adds a new enemy /// </summary> /// <param name="sender">not used</param> /// <param name="e">not used</param> private void addButton_Click(object sender, RoutedEventArgs e) { try { EnemyInstance enemy = new EnemyInstance(EnemyData.GetEnemyNames()[0], 0, 1); if (spawn.enemies.Count == 0) enemyComboBox.Items.Remove("None"); spawn.enemies.Add(enemy); enemyComboBox.Items.Add(enemy.name); WaveEnemyEditor editor = new WaveEnemyEditor(enemy); editor.Owner = this; editor.ShowDialog(); enemyComboBox.Items[enemyComboBox.Items.Count - 1] = enemy.name; enemyComboBox.SelectedItem = enemy.name; } catch (Exception) { MessageBox.Show("There are no enemies to add."); } }
/// <summary> /// Edits the selected enemy /// </summary> /// <param name="sender">not used</param> /// <param name="e">not used</param> private void editButton_Click(object sender, RoutedEventArgs e) { if (spawn.enemies.Count == 0) { MessageBox.Show("There are no enemies to edit."); return; } EnemyInstance enemy = spawn.enemies[enemyComboBox.SelectedIndex]; WaveEnemyEditor editor = new WaveEnemyEditor(enemy); editor.Owner = this; editor.ShowDialog(); enemyComboBox.Items[enemyComboBox.SelectedIndex] = enemy.name; enemyComboBox.SelectedItem = enemy.name; }