Пример #1
0
        static void Main(string[] args)
        {
            var UsageText = "<< Press any key to continue >>";
            var characters = new List<ICharacter>
                {
                    new King(),
                    new Queen(),
                    new Knight(),
                    new Troll()
                };

            foreach (var character in characters)
            {
                character.Fight();
                if (character.GetType() == typeof(Knight))
                {
                    character.Weapon = new Sword();
                    character.Fight();

                    character.Weapon = new Axe();
                    character.Fight();
                }
                Console.WriteLine(UsageText);
                Console.ReadLine();
            }

            var jedi = new Jedi();
            jedi.Fight();
            Console.WriteLine(UsageText);
            Console.ReadLine();

            var knightWithLightSaber = new Knight(new LightSaber());
            knightWithLightSaber.Fight();

            Console.ReadLine();
        }
 public void RecruitKnights()
 {
     var faction = new Knights();
     var counter = 0;
     for (var i = 0; i < 5; i++)
     {
         var soldier = new Jedi();
         soldier.Weapon = faction.StandardIssueWeapon;
         faction.Soldiers.Add(soldier);
     }
     Legion.Factions.Add(faction);
 }