Exemplo n.º 1
0
 public CollisionManager(PlayerShip playerShip, ShotManager shotManager, EnemyManager enemyManager, ExplosionManager explosionManager)
 {
     this.playerShip       = playerShip;
     this.shotManager      = shotManager;
     this.enemyManager     = enemyManager;
     this.explosionManager = explosionManager;
 }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        public EnemyManager(Texture2D texture, Rectangle bounds, ShotManager shotManager)
        {
            this.texture     = texture;
            this.bounds      = bounds;
            this.shotManager = shotManager;

            CreateEnemy();
        }
Exemplo n.º 4
0
 public Enemy(Texture2D texture, Vector2 position, Rectangle bounds, ShotManager shotManager)
     : base(texture, position, bounds)
 {
     this.shotManager = shotManager;
     Speed            = 200;
 }
Exemplo n.º 5
0
 public PlayerShip(Texture2D texture, Vector2 position, Rectangle movementBounds, ShotManager shotManager)
     : base(texture, position, movementBounds, 2, 2, 7)
 {
     this.shotManager = shotManager;
     Speed            = 300;
 }