Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();

            //Создаём героев
            player1 = LeftHero.Instance();
            player2 = RightHero.Instance();

            //Танки для левого героя
            player1.AddObserver(new HeavyTank(this, "left"));
            player1.AddObserver(new HeavyTank(this, "left"));
            player1.AddObserver(new LightTank(this, "left"));
            player1.AddObserver(new LightTank(this, "left"));
            player1.AddObserver(new LightTank(this, "left"));

            //Танки для правого героя
            player2.AddObserver(new HeavyTank(this, "right"));
            player2.AddObserver(new HeavyTank(this, "right"));
            player2.AddObserver(new LightTank(this, "right"));
            player2.AddObserver(new LightTank(this, "right"));
            player2.AddObserver(new LightTank(this, "right"));

            //Бомбы для левого героя
            player1.AddBomb(new SmallBomb("lS1"));
            player1.AddBomb(new SmallBomb("lS2"));
            player1.AddBomb(new SmallBomb("lS3"));
            player1.AddBomb(new MiddleBomb("lM1"));
            player1.AddBomb(new MiddleBomb("lM2"));
            player1.AddBomb(new LargeBomb("lL1"));

            //Бомбы для правого героя
            player2.AddBomb(new SmallBomb("rS1"));
            player2.AddBomb(new SmallBomb("rS2"));
            player2.AddBomb(new SmallBomb("rS3"));
            player2.AddBomb(new MiddleBomb("rM1"));
            player2.AddBomb(new MiddleBomb("rM2"));
            player2.AddBomb(new LargeBomb("rL1"));

            //Добавляем бомбы в списки
            foreach (Bomb item in player1.GetBombs())
            {
                bombSelectLeft.Items.Add(item);
            }
            foreach (Bomb item in player2.GetBombs())
            {
                bombSelectRight.Items.Add(item);
            }
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();

            //Создаём героев
            player1 = LeftHero.Instance();
            player2 = RightHero.Instance();

            //Танки для левого героя
            player1.AddObserver(new HeavyTank(this, "left"));
            player1.AddObserver(new HeavyTank(this, "left"));
            player1.AddObserver(new LightTank(this, "left"));
            player1.AddObserver(new LightTank(this, "left"));
            player1.AddObserver(new LightTank(this, "left"));

            //Танки для правого героя
            player2.AddObserver(new HeavyTank(this, "right"));
            player2.AddObserver(new HeavyTank(this, "right"));
            player2.AddObserver(new LightTank(this, "right"));
            player2.AddObserver(new LightTank(this, "right"));
            player2.AddObserver(new LightTank(this, "right"));

            //Бомбы для левого героя
            player1.AddBomb(new SmallBomb("lS1"));
            player1.AddBomb(new SmallBomb("lS2"));
            player1.AddBomb(new SmallBomb("lS3"));
            player1.AddBomb(new MiddleBomb("lM1"));
            player1.AddBomb(new MiddleBomb("lM2"));
            player1.AddBomb(new LargeBomb("lL1"));

            //Бомбы для правого героя
            player2.AddBomb(new SmallBomb("rS1"));
            player2.AddBomb(new SmallBomb("rS2"));
            player2.AddBomb(new SmallBomb("rS3"));
            player2.AddBomb(new MiddleBomb("rM1"));
            player2.AddBomb(new MiddleBomb("rM2"));
            player2.AddBomb(new LargeBomb("rL1"));

            //Добавляем бомбы в списки
            foreach (Bomb item in player1.GetBombs())
            {
                bombSelectLeft.Items.Add(item);
            }
            foreach (Bomb item in player2.GetBombs())
            {
                bombSelectRight.Items.Add(item);
            }
        }