Пример #1
0
        static void Main(string[] args)
        {
            Army[] arrArmys = new Army[10];

            arrArmys[0] = new Barbarian();
            arrArmys[1] = new Giant();
            arrArmys[2] = new Healer();
            arrArmys[3] = new Healer();
            arrArmys[4] = new Giant();

            for (int i = 0; i < arrArmys.Length; i++)
            {
                if (null != arrArmys[i])
                {
                    arrArmys[i].Run();
                    System.Threading.Thread.Sleep(1000);
                }
            }

            System.Threading.Thread.Sleep(1000);

            for (int i = 0; i < arrArmys.Length; i++)
            {
                if (null != arrArmys[i])
                {
                    arrArmys[i].Attack();
                    System.Threading.Thread.Sleep(1000);
                }
            }
        }
Пример #2
0
        public static void Main(string[] args)
        {
            Army[] arrArmy = new Army[10];

            arrArmy[0] = new Barbarian();
            arrArmy[1] = new Barbarian();
            arrArmy[2] = new Healer();

            for (int i = 0; i < arrArmy.Length; i++)
            {
                if (arrArmy[i] != null)
                {
                    arrArmy[i].Run();
                    System.Threading.Thread.Sleep(1000);
                }
            }

            System.Threading.Thread.Sleep(1000);

            for (int i = 0; i < arrArmy.Length; i++)
            {
                if (arrArmy[i] != null)
                {
                    arrArmy[i].Attack();
                    System.Threading.Thread.Sleep(1000);
                }
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            Army[] arrArmys = new Army[10];

            arrArmys[0] = new Barbarian();
            arrArmys[1] = new Giant();
            arrArmys[2] = new Healer();

            for (int i = 0; i < arrArmys.Length; i++)
            {
                if (null != arrArmys[i])
                {
                    arrArmys[i].Run();
                }
            }

            for (int i = 0; i < arrArmys.Length; i++)
            {
                if (null != arrArmys[i])
                {
                    arrArmys[i].Attack();
                }
            }
        }