Пример #1
0
        public override void Initialize(ExplosionFactory explosionFactory)
        {
            base.Initialize(explosionFactory);

            for (int i = 0; i < 5; i++)
            {
                _explosions.Add(_explosionFactory.GetExplosion());
            }
        }
Пример #2
0
        public void Initialize(Texture2D enemyTexture, ExplosionFactory explosionFactory, int screenWidth, int screenHeight)
        {
            _enemyTexture = enemyTexture;
            _explosionFactory = explosionFactory;
            _screenWidth = screenWidth;
            _screenHeight = screenHeight;

            Enemies = new List<Enemy>();

            _previousSpawnTime = TimeSpan.Zero;

            _enemySpawnTime = TimeSpan.FromSeconds(.25f);

            _random = new Random();
        }
Пример #3
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

            _hitboxTexture = Content.Load<Texture2D>("Graphics/HitboxDim");

            SoundEffect explosionSound = Content.Load<SoundEffect>("Sounds/explosion");
            Texture2D explosionStrip = Content.Load<Texture2D>("Graphics/explosion");
            ExplosionFactory explosionFactory = new ExplosionFactory(explosionStrip, explosionSound);

            //Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X,
            //    GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);

            Vector2 playerPosition = new Vector2(0, _screenHeight / 2);

            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("Graphics/shipAnimation");

            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 35, Color.White, .75f, true);

            Death playerDeath = new PlayerDeath();
            playerDeath.Initialize(explosionFactory);

            //player.Initialize(playerAnimation, playerPosition, input, _projectileManager, _screenHeight, _screenWidth, _hitboxTexture);
            player.Initialize(playerAnimation, playerDeath, playerPosition, input, _projectileManager, _screenHeight, _screenWidth);

            Texture2D enemyTexture = Content.Load<Texture2D>("Graphics/mineAnimation");

            _projectileManager.Initialize(_screenWidth, _screenHeight);

            //enemyManager.Initialize(enemyTexture, explosionStrip, explosionSound, _screenWidth, _screenHeight, _hitboxTexture);
            enemyManager.Initialize(enemyTexture, explosionFactory, _screenWidth, _screenHeight);

            ParallaxingBackground bgLayer1 = new ParallaxingBackground(); 
            ParallaxingBackground bgLayer2 = new ParallaxingBackground();

            bgLayer1.Initialize(Content.Load<Texture2D>("Graphics/bgLayer1"), _screenWidth, _screenHeight, -1);
            bgLayer2.Initialize(Content.Load<Texture2D>("Graphics/bgLayer2"), _screenWidth, _screenHeight, -2);

            Texture2D mainBackground;
            mainBackground = Content.Load<Texture2D>("Graphics/mainbackground");

            gameBackground.Initialize(mainBackground, new ParallaxingBackground[] { bgLayer1, bgLayer2 }, _screenWidth, _screenHeight);

            fogForeground.Initialize(Content.Load<Texture2D>("Graphics/WispyClouds2"), _screenWidth, _screenHeight, -2);

            SoundEffect laserSound = Content.Load<SoundEffect>("Sounds/LaserFire");
            Texture2D laserTexture = Content.Load<Texture2D>("Graphics/laser");
            laserCannon.Initialize(laserTexture, laserSound);
            
            player.Weapon = laserCannon;

            gameMusic = Content.Load<Song>("Music/gameMusic");

            _pauseBackground = Content.Load<Texture2D>("Graphics/Pause");

            MediaPlayer.Volume = .75f;
            MediaPlayer.Play(gameMusic);
        }
Пример #4
0
 public virtual void Initialize(ExplosionFactory explosionFactory)
 {
     _explosionFactory = explosionFactory;
 }
Пример #5
0
        public void Initialize(Texture2D enemyTexture, ExplosionFactory explosionFactory, int screenWidth, int screenHeight, Texture2D hitboxTexture)
        {
            Initialize(enemyTexture, explosionFactory, screenWidth, screenHeight);

            _hitboxTexture = hitboxTexture;
        }