示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            _backgroundTexture = Content.Load <Texture2D>(@"Textures\space-tiled-background-256x256");
            _playerTexture     = Content.Load <Texture2D>(@"Textures\SpaceShipSmall");
            _bulletTexture     = Content.Load <Texture2D>(@"Textures\Bullet");
            _enemyTexture      = Content.Load <Texture2D>(@"Textures\enemy");
            _bulletFactory     = new BulletFactory(_bulletTexture.Width, _bulletTexture.Height, _graphics.PreferredBackBufferHeight);
            _shooting          = new Shooting(_bulletFactory);
            _player            = new Player(_shooting, _graphics.PreferredBackBufferWidth - _playerTexture.Width, _graphics.PreferredBackBufferHeight, _playerTexture.Width, _playerTexture.Height);
            _enemy             = new Enemy(_graphics.PreferredBackBufferHeight, _graphics.PreferredBackBufferWidth, _enemyTexture.Width, _enemyTexture.Height);

            _laserSound = Content.Load <SoundEffect>(@"SoundEffects\laser");
        }
示例#2
0
 public Shooting(BulletFactory bulletFactory)
 {
     _bulletFactory = bulletFactory;
     _bullet        = bulletFactory.Create();
 }