public Knight(String name, ListBox display)
            : base(name, display)
        {
            this.name    = name;
            this.display = display;

            //default weapon
            weapon = new KnifeWeapon();
        }
        public Knight(String name, ListBox display)
            : base(name, display)
        {
            this.name = name;
            this.display = display;

            //default weapon
            weapon = new KnifeWeapon();
        }
Beispiel #3
0
        //changes weapons of all the selected characters to the weapon selected in the radio group
        private void buttonChangeWeapon_Click(object sender, EventArgs e)
        {
            IWeapon changedWeapon = new SwordWeapon();

            if (rdKnife.Checked == true)
            {
                changedWeapon = new KnifeWeapon();
            }
            if (rdBow.Checked == true)
            {
                changedWeapon = new BowWeapon();
            }
            if (rdSword.Checked == true)
            {
                changedWeapon = new SwordWeapon();
            }
            foreach (Character checkedCharacter in checkedListBoxWeapon.CheckedItems)
            {
                checkedCharacter.ChangeWeapon(changedWeapon);
            }
        }
 //changes weapons of all the selected characters to the weapon selected in the radio group
 private void buttonChangeWeapon_Click(object sender, EventArgs e)
 {
     IWeapon changedWeapon = new SwordWeapon();
     if (rdKnife.Checked == true) changedWeapon = new KnifeWeapon();
     if (rdBow.Checked == true) changedWeapon = new BowWeapon();
     if (rdSword.Checked == true) changedWeapon = new SwordWeapon();
     foreach (Character checkedCharacter in checkedListBoxWeapon.CheckedItems)
     {
         checkedCharacter.ChangeWeapon(changedWeapon);
     }
 }