Beispiel #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            //контроллер
            _keyboardController = new KeyboardController(this);

            //игрок
            Player        = new Player(_PlayerTexture);
            Player._laser = _PlayerLaser;
            Player.SetPosition(120, graphics.PreferredBackBufferHeight / 2);
            Player.SetScale(0.5f);
            _keyboardController.Attach(Player);

            //фон
            Background = new Background(_t);

            //астероиды
            _asteroid1 = new Asteroids(_asteroidTexture1, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            _asteroid2 = new Asteroids(_asteroidTexture2, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            _asteroid3 = new Asteroids(_asteroidTexture3, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            _asteroid4 = new Asteroids(_asteroidTexture4, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            _asteroid5 = new Asteroids(_asteroidTexture5, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            //бонусы
            _bonusHeals = new Bonuses(_heart);
            _bonusHeals.SetPosition(500, 500);
            _bonusHeals.SetScale(0.6f);
            _bonusHeals.SetVelocity(new Vector2(-1, 0));
        }