Esempio n. 1
0
        //protected override void Initialize()
        //{
        //    base.Initialize();

        //    _graphicsDeviceManager.IsFullScreen = true;
        //    _graphicsDeviceManager.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
        //    _graphicsDeviceManager.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
        //    _graphicsDeviceManager.ApplyChanges();
        //}

        protected override void LoadContent()
        {
            _viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, 800, 480);
            _font = Content.Load<BitmapFont>("Fonts/courier-new-32");

            _camera = new Camera2D(_viewportAdapter);
            _explosionAnimations = Content.Load<SpriteSheetAnimationGroup>("explosion-animations");

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _backgroundTexture = Content.Load<Texture2D>("black");

            var bulletTexture = Content.Load<Texture2D>("laserBlue03");
            var bulletRegion = new TextureRegion2D(bulletTexture);
            _bulletFactory = new BulletFactory(_entityManager, bulletRegion);

            SpawnPlayer(_bulletFactory);

            _meteorFactory = new MeteorFactory(_entityManager, Content);

            for (var i = 0; i < 13; i++)
            {
                _meteorFactory.SpawnNewMeteor(_player.Position);
            }
        }
Esempio n. 2
0
 private void SpawnPlayer(BulletFactory bulletFactory)
 {
     var spaceshipTexture = Content.Load<Texture2D>("playerShip1_blue");
     var spaceshipRegion = new TextureRegion2D(spaceshipTexture);
     _player = _entityManager.AddEntity(new Spaceship(spaceshipRegion, bulletFactory));
 }