コード例 #1
0
 public CollisionManager(Rocket rocket, FireManager fireManager, EnemyManager enemyManager, ExplosionManager explosionManager)
 {
     this.rocket = rocket;
     this.fireManager = fireManager;
     this.enemyManager = enemyManager;
     this.explosionManager = explosionManager;
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: eturan/ShooterGame
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            score = 0;

            spriteBatch = new SpriteBatch(GraphicsDevice);
            titleScreen = new Sprite(Content.Load<Texture2D>("title"), Vector2.Zero, graphics.GraphicsDevice.Viewport.Bounds, 2, 2, 8);
            background = new Sprite(Content.Load<Texture2D>("space"),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 rocketTexture = Content.Load<Texture2D>("rocket");
            var yPositionOfRocket = graphics.GraphicsDevice.Viewport.Height - rocketTexture.Height - 10;
            var xPositionOfRocket = (graphics.GraphicsDevice.Viewport.Width / 2) - (rocketTexture.Width / 2);

            var rocketBounds = new Rectangle(0, graphics.GraphicsDevice.Viewport.Height - 600, graphics.GraphicsDevice.Viewport.Width, 600);

            fireManager = new FireManager(Content.Load<Texture2D>("fire"), graphics.GraphicsDevice.Viewport.Bounds,soundManager);
            rocket = new Rocket(rocketTexture, new Vector2(xPositionOfRocket, yPositionOfRocket), rocketBounds, fireManager);
            enemyManager = new EnemyManager(Content.Load<Texture2D>("alienship"), graphics.GraphicsDevice.Viewport.Bounds, fireManager);
            explosionManager = new ExplosionManager(Content.Load<Texture2D>("explosion"),graphics.GraphicsDevice.Viewport.Bounds,soundManager);
            collisionManager = new CollisionManager(rocket, fireManager, enemyManager,explosionManager);

            soundManager.PlayBackgroundMusic();

            gameFont = Content.Load<SpriteFont>("GameFont");
        }