コード例 #1
0
ファイル: Program.cs プロジェクト: 1is0/Shpilevsky
        static void Main(string[] args)
        {
            Appearance forArch   = new Appearance(64, "Ирокез", "Ельф");
            Appearance forHealer = new Appearance(32, "Рыжий", "Человек");

            Archer   ar = new Archer(Bow.Bone3000);
            Cavalier cv = new Cavalier(Sword.StickFromTheYard);
            Healer   hl = new Healer(HealingDevice.MumScream);

            cv.ShowInfo();

            ar.Hit  += (Hero, e) => Console.WriteLine("{0}", e.msg);
            hl.Heal += (Hero, e) => Console.WriteLine("{0}", e.msg);

            for (int i = 0; i < 2; i++)
            {
                ar.Attack(cv);
            }

            cv.ShowInfo();

            Console.WriteLine("\nPress sth to view prologue...");
            Console.ReadKey();
            Console.Clear();

            hl.HealUnit(cv);

            cv.ShowInfo();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Appearance forArch   = new Appearance(64, "Ирокез", "Ельф");
            Appearance forHealer = new Appearance(32, "Рыжий", "Человек");
            Appearance forUnit   = new Appearance(60, "Темные короткие", "Люди");

            Archer ar  = new Archer(Bow.Bone3000);
            Archer ar1 = (Archer)ar.Clone();

            Cavalier cv = new Cavalier(Sword.StickFromTheYard);
            Unit     un = new Unit(150, 200, 400, "Пивовар", forUnit);
            Healer   hl = new Healer(HealingDevice.MumScream);

            Unit[] units = new Unit[] { ar, ar1, cv, un, hl };

            Array.Sort(units);

            foreach (Unit unit in units)
            {
                unit.ShowInfo();
            }

            ar1.Attack(ar);
            ar.ShowInfo();

            hl.HealUnit(ar);
            ar.ShowInfo();
        }