Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            IPersonage personage = null;
            IWeapon    weapon    = null;
            ITeam      team      = null;

            if (king.IsChecked == true)
            {
                personage = new King();
            }
            else if (queen.IsChecked == true)
            {
                personage = new Queen();
            }
            else if (knight.IsChecked == true)
            {
                personage = new Knight();
            }
            else if (troll.IsChecked == true)
            {
                personage = new Troll();
            }

            if (sword.IsChecked == true)
            {
                weapon = new Sword();
            }
            else if (bow.IsChecked == true)
            {
                weapon = new Bow();
            }
            else if (arbalet.IsChecked == true)
            {
                weapon = new Arbalet();
            }


            if (red.IsChecked == true)
            {
                team = new Red();
            }
            else if (green.IsChecked == true)
            {
                team = new Green();
            }
            else if (blue.IsChecked == true)
            {
                team = new Blue();
            }
            else if (yellow.IsChecked == true)
            {
                team = new Yellow();
            }

            Character character = new Character(personage, weapon, team);

            MessageBox.Show(character.ShowCharacter());
            king.IsChecked    = false;
            queen.IsChecked   = false;
            knight.IsChecked  = false;
            troll.IsChecked   = false;
            sword.IsChecked   = false;
            bow.IsChecked     = false;
            arbalet.IsChecked = false;
            red.IsChecked     = false;
            green.IsChecked   = false;
            blue.IsChecked    = false;
            yellow.IsChecked  = false;
        }
Example #2
0
 public PersonageApiController(IPersonage personage)
 {
     _personage = personage;
 }
Example #3
0
 public Character(IPersonage personage, IWeapon weapon, ITeam team)
 {
     this.personage = personage;
     this.weapon    = weapon;
     this.team      = team;
 }