Exemple #1
0
 private void btnBattle_Click(object sender, EventArgs e)
 {
     if (checkedListBox1.CheckedIndices.Count != 2)
     {
         MessageBox.Show("Please select exactly 2 characters for battle.");
     }
     else
     {
         listBox1.Items.Clear();
         //loop through checked items and call Name, Rank, Attack
         foreach (int indexChecked in checkedListBox1.CheckedIndices)
         {
             Character c = characterList[indexChecked];
             c.SayName();
             c.Speak();
             c.Attack();
         }
     }
 }