Exemple #1
0
        public LevelScreen(Spawner spawner, SpriteManager backSpriteManager, SpriteManager midSpriteManager, SpriteManager frontSpriteManager)
        {
            _backSpriteManager = backSpriteManager;
            _midSpriteManager = midSpriteManager;
            _frontSpriteManager = frontSpriteManager;

            _spawner = spawner;
        }
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            gameFont = Game.Content.Load<SpriteFont>("gamefont");
            Texture2D hbarTexture = Game.Content.Load<Texture2D>("hbar");

            _spawner = new Spawner(Game.Content, ScreenManager.SpriteBatch);
            _healthBar = new HealthBar(hbarTexture, ScreenManager.SpriteBatch);
            _level = new LevelScreen(_spawner, _backSpriteManager, _midSpriteManager, _frontSpriteManager);
            _level.ScreenManager = this.ScreenManager;
            _level.ControllingPlayer = this.ControllingPlayer;
            _level.LoadContent();
            _level.Initialize();
            _audioManager.PlaySong("loop");
            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.
            Thread.Sleep(1000);
            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            Game.ResetElapsedTime();
        }