Exemple #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()
        {
            spriteBatch    = new SpriteBatch(GraphicsDevice);
            titleScreen    = new Sprite(Content.Load <Texture2D>("start"), Vector2.Zero, graphics.GraphicsDevice.Viewport.Bounds, 2, 2, 8);
            background     = new Sprite(Content.Load <Texture2D>("background"), Vector2.Zero, graphics.GraphicsDevice.Viewport.Bounds);
            pauseScreen    = new Sprite(Content.Load <Texture2D>("paused"), 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>("ship1");
            var xPositionOfShip = (graphics.GraphicsDevice.Viewport.Width / 2) - (shipTexture.Width / 2);
            var yPositionOfShip = graphics.GraphicsDevice.Viewport.Height - shipTexture.Height - 10;
            var playerBounds    = new Rectangle(0, graphics.GraphicsDevice.Viewport.Height - 200, graphics.GraphicsDevice.Viewport.Width, 200);

            shotManager      = new ShotManager(Content.Load <Texture2D>("shot"), graphics.GraphicsDevice.Viewport.Bounds, soundManager);
            playerShip       = new PlayerShip(shipTexture, new Vector2(xPositionOfShip, yPositionOfShip), playerBounds, shotManager);
            enemyManager     = new EnemyManager(Content.Load <Texture2D>("enemy"), 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
            };
        }
Exemple #2
0
 public EnemyManager(Texture2D texture, Rectangle bounds, ShotManager shotManager)
 {
     this.texture     = texture;
     this.bounds      = bounds;
     this.shotManager = shotManager;
     CreateEnemy();
 }
 public CollisionManager(PlayerShip playerShip, ShotManager shotManager, EnemyManager enemyManager, ExplosionManager explosionManager)
 {
     this.playerShip       = playerShip;
     this.shotManager      = shotManager;
     this.enemyManager     = enemyManager;
     this.explosionManager = explosionManager;
 }
Exemple #4
0
 public Enemy(Texture2D texture, Vector2 position, Rectangle bounds, ShotManager shotManager) : base(texture, position, bounds, 2, 2, 14)
 {
     this.shotManager = shotManager;
     Speed            = 200;
 }
Exemple #5
0
 public PlayerShip(Texture2D texture, Vector2 position, Rectangle movementBounds, ShotManager shotManager)
     : base(texture, position, movementBounds, 2, 2, 14)
 {
     this.shotManager = shotManager;
     Speed            = 300;
 }