Exemple #1
0
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            asteroidManager = new AsteroidManager(content, Mode.TITLE);
            starField       = new StarField(content);
        }
Exemple #2
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            gameFont = content.Load <SpriteFont>("font/gamefont");

            asteroidManager = new AsteroidManager(content, Mode.GAME);

            // Create the players ship
            if (networkSession == null)
            {
                Player p = new Player(content, ControllingPlayer);
                p.onGameOver += OnGameOver;

                // Set HUD properties
                p.ScoreRegion = scoreRegions[0];

                players.Add(p);
            }

            // Load Background Music - (http://freemusicarchive.org/music/Edward_Shallow/World_Head_Law/02_Poisons__Potions)
            backgroundMusic = content.Load <Song>("sound/background");

            // 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);

            // Create the star field
            starField = new StarField(content);

            // Initialize the game
            InitGame();

            // 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.
            ScreenManager.Game.ResetElapsedTime();
        }