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()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), spriteBatch);

            // Load audio elements
            audio = new AudioLibrary();
            audio.LoadContent(Content);
            Services.AddService(typeof(AudioLibrary), audio);

            // Create help screens
            helpBackgroundTexture = Content.Load<Texture2D>("helpbackground");
            helpForegroundTexture = Content.Load<Texture2D>("helpforeground");
            helpScene = new HelpScene(this, helpBackgroundTexture, helpForegroundTexture);
            Components.Add(helpScene);

            // Create the Start Scene
            smallFont = Content.Load<SpriteFont>("menuSmall");
            largeFont = Content.Load<SpriteFont>("menuLarge");
            startBackgroundTexture = Content.Load<Texture2D>("startbackground");
            startElementsTexture = Content.Load<Texture2D>("startSceneElements");
            startScene = new StartScene(this, smallFont, largeFont,
                startBackgroundTexture, startElementsTexture);
            Components.Add(startScene);

            // Create the Action Scene
            scoreFont = Content.Load<SpriteFont>("score");
            actionElementsTexture = Content.Load<Texture2D>("rockrainenhanced");
            actionBackgroundTexture = Content.Load<Texture2D>("SpaceBackground");
            actionScene = new ActionScene(this, actionElementsTexture,
                actionBackgroundTexture, scoreFont);
            Components.Add(actionScene);

            // Starts the game
            startScene.Show();
            activeScene = startScene;
        }
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice);
            Services.AddService(typeof(SpriteBatch), _spriteBatch);

            _audio.LoadContent(this.Content);
            Services.AddService(typeof(AudioLibrary), _audio);

            this._helpBackgroundTexture = Content.Load<Texture2D>("helpbackground");
            this._helpForegroundTexture = Content.Load<Texture2D>("helpforeground");
            _helpScene = new HelpScene(this, this._helpBackgroundTexture, this._helpForegroundTexture);
            Components.Add(_helpScene);

            // Create the Start scene
            this._smallFont = Content.Load<SpriteFont>("menuSmall");
            this._largeFont = Content.Load<SpriteFont>("menuLarge");
            this._startBackgroundTexture = Content.Load<Texture2D>("startBackground");
            this._startElementsTexture = Content.Load<Texture2D>("startSceneElements");
            _startScene = new StartScene(this, this._smallFont, this._largeFont, this._startBackgroundTexture, this._startElementsTexture);
            Components.Add(_startScene);

            this._actionElementsTexture = Content.Load<Texture2D>("rockrainenhanced");
            this._actionBackgroundTexture = Content.Load<Texture2D>("spacebackground");
            this._scoreFont = Content.Load<SpriteFont>("score");

            _joinScene = new JoinScene(this, this._largeFont, this._menuControllers);
            Components.Add(_joinScene);
            _startScene.Show();
            _activeScene = _startScene;
            _scoreScene = new ScoreScene(this, this._largeFont, _highScores, _startBackgroundTexture);
            Components.Add(_scoreScene);
        }
Exemple #3
0
 /// <summary>
 /// Open a new scene
 /// </summary>
 /// <param name="scene">Scene to be opened</param>
 protected void ShowScene(GameScene scene)
 {
     activeScene.Hide();
     activeScene = scene;
     scene.Show();
 }
        void ShowScene(GameScene scene)
        {
            _activeScene.Hide();

            _activeScene = scene;
            scene.Show();
            Debug.WriteLine("Active scene is now " + scene.GetType().Name);
        }