public CollisionManager(PlayerShip playerShip, ShotManager shotManager, EnemyManager enemyManager, ExplosionManager explosionManager)
 {
     this.playerShip       = playerShip;
     this.shotManager      = shotManager;
     this.enemyManager     = enemyManager;
     this.explosionManager = explosionManager;
 }
Example #2
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
            titleScreen    = new Sprite(Content.Load <Texture2D>("titleScreen"), Vector2.Zero, graphics.GraphicsDevice.Viewport.Bounds, 2, 2, 8);
            background     = new Sprite(Content.Load <Texture2D>("fundo"), Vector2.Zero, graphics.GraphicsDevice.Viewport.Bounds);
            pauseScreen    = new Sprite(Content.Load <Texture2D>("pause"), Vector2.Zero, graphics.GraphicsDevice.Viewport.Bounds);
            gameOverScreen = new Sprite(Content.Load <Texture2D>("gameover"), Vector2.Zero, graphics.GraphicsDevice.Viewport.Bounds);

            soundManager = new SoundManager(Content);

            var shipTexture     = Content.Load <Texture2D>("nave");
            var xPositionOfShip = graphics.GraphicsDevice.Viewport.Height - shipTexture.Height - 10;
            var yPositionOfShip = (graphics.GraphicsDevice.Viewport.Width / 2) - (shipTexture.Width / 2) + 70;
            var playerBounds    = new Rectangle(0, graphics.GraphicsDevice.Viewport.Height - 200, graphics.GraphicsDevice.Viewport.Width, 200);

            shotManager      = new ShotManager(Content.Load <Texture2D>("tiro"), graphics.GraphicsDevice.Viewport.Bounds, soundManager);
            playership       = new PlayerShip(shipTexture, new Vector2(xPositionOfShip, yPositionOfShip), playerBounds, shotManager);
            enemyManager     = new EnemyManager(Content.Load <Texture2D>("alien"), graphics.GraphicsDevice.Viewport.Bounds, shotManager);
            explosionManager = new ExplosionManager(Content.Load <Texture2D>("explosion"), graphics.GraphicsDevice.Viewport.Bounds, soundManager);
            collisionManager = new CollisionManager(playership, shotManager, enemyManager, explosionManager);
            gameFont         = Content.Load <SpriteFont>("GameFont");

            statusManager = new StatusManager(gameFont, graphics.GraphicsDevice.Viewport.Bounds, enemyManager, shipTexture)
            {
                Lives = 3,
                Score = 0
            };

            soundManager.PlayBackgroundMusic();
        }