Load() public method

Loads the level from the content manager
public Load ( Microsoft.Xna.Framework.Content.ContentManager content ) : void
content Microsoft.Xna.Framework.Content.ContentManager Content Manager to load from
return void
Exemplo n.º 1
0
        /// <summary>
        /// Handle any changes while on the level selection menu
        /// </summary>
        /// <param name="gameTime">Current time within the game</param>
        /// <param name="gameState">Current gamestate of the game</param>
        /// <param name="currentLevel">Current level of the game</param>
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level currentLevel)
        {
            //Handle loading after loading screen has been drawn
            if (_mLoading == Loading)
            {
                _mLoading = None;
                if (currentLevel != null) currentLevel.Dispose();
                currentLevel = _mLevels[_mCurrentWorld * 6 + _mCurrentIndex].Level;
                currentLevel.Load(_mContent);

                currentLevel.IdealTime = _mLevels[_mCurrentWorld * 6 + _mCurrentIndex].GetGoal(LevelInfo.StarTypes.Time);
                currentLevel.CollectableCount = _mLevels[_mCurrentWorld * 6 + _mCurrentIndex].GetGoal(LevelInfo.StarTypes.Collection);

                currentLevel.TimerStar = _mLevels[_mCurrentWorld * 6 + _mCurrentIndex].GetStar(LevelInfo.StarTypes.Time);
                currentLevel.CollectionStar = _mLevels[_mCurrentWorld * 6 + _mCurrentIndex].GetStar(LevelInfo.StarTypes.Collection);
                currentLevel.DeathStar = _mLevels[_mCurrentWorld * 6 + _mCurrentIndex].GetStar(LevelInfo.StarTypes.Death);

                gameState = GameStates.StartLevelSplash;
            }

            HandleAKey(ref gameState, ref currentLevel);
            HandleBKey(ref gameState);
            HandleDirectionKey();

            UpdateStarCount();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     LoadContent will be called once per game and is the place to load
        ///     all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // current viewport
            var screenscaleX = Graphics.GraphicsDevice.Viewport.Width / 1280.0f;
            var screenscaleY = Graphics.GraphicsDevice.Viewport.Height / 720.0f;

            // Create the scale transform for Draw.
            // Do not scale the sprite depth (Z=1).
            _mScale = Matrix.CreateScale(screenscaleX, screenscaleY, 1);

            _mTitle.Load(Content, Graphics.GraphicsDevice);

            _mMainMenu.Load(Content);
            _mMainMenuLevel = Level.MainMenuLevel("Content\\Levels\\MainMenu.xml", _mControls, Graphics.GraphicsDevice.Viewport, _mMainMenu.GetInnerRegion());

            _mMainMenuLevel.Load(Content);
            _mCredits.Load(Content);
            _mOptions.Load(Content);

            _mPause.Load(Content);
            GameSound.Load(Content);
            _mCurrentLevel = new Level(_mLevelLocation, _mControls, GraphicsDevice.Viewport);
            _mCurrentLevel.Load(Content);

            _mWorldSelect.Load(Content);
            _mScoring.Load(Content, Graphics.GraphicsDevice, _mWorldSelect);
            _mAfterScore.Load(Content, GraphicsDevice);
            _mPreScore.Load(Content, GraphicsDevice, _mWorldSelect);
            _mResetConfirm.Load(Content);
            _mController.Load(Content);
            _mSoundOptions.Load(Content);
            _mStartLevelSplash.Load(Content, GraphicsDevice);
            _mPurchaseScreenSplash.Load(Content, GraphicsDevice);
            _mWorldPurchaseScreenSplash.Load(Content, GraphicsDevice);

            _mSpriteBatch = new SpriteBatch(GraphicsDevice);

            Content.Load<SpriteFont>("Fonts/Kootenay");

            _mQuartz = Content.Load<SpriteFont>("Fonts/QuartzLarge");
            _mHudTrans = Content.Load<Texture2D>("Images/HUD/HUDTrans");

            _mLives = new Texture2D[6];
            _mLives[5] = Content.Load<Texture2D>("Images/Player/Laugh2");
            _mLives[4] = Content.Load<Texture2D>("Images/Player/Laugh");
            _mLives[3] = Content.Load<Texture2D>("Images/Player/Smile");
            _mLives[2] = Content.Load<Texture2D>("Images/Player/Surprise");
            _mLives[1] = Content.Load<Texture2D>("Images/Player/Worry");
            _mLives[0] = Content.Load<Texture2D>("Images/Player/Dead2");
        }
Exemplo n.º 3
0
 /// <summary>
 /// Handle what happens when the player presses A for all options
 /// </summary>
 /// <param name="gameState">State of the game - Reference so that it can be changed for the main game class to handle</param>
 /// <param name="currentLevel">Current level in the main game - Reference so that this can be changed for the main game class to handle</param>
 private void HandleAPressed(ref GameStates gameState, ref Level currentLevel)
 {
     if (_mCurrentIndex == Back)
     {
         gameState = GameStates.MainMenu;
         _mCurrentPage = 0;
         _mCurrentIndex = 1;
     }
     else if (_mCurrentIndex == Previous)
     {
         if (--_mCurrentPage < 0) _mCurrentPage = 0;
     }
     else if (_mCurrentIndex == Next)
     {
         if (++_mCurrentPage == _mPageCount) _mCurrentPage = _mPageCount - 1;
     }
     else if(_mLevels[_mCurrentIndex - 1 + 12 * _mCurrentPage].Unlocked)
     {
         currentLevel = _mLevels[_mCurrentIndex - 1 + 12 * _mCurrentPage].Level;
         currentLevel.Load(_mContent);
         gameState = GameStates.InGame;
     }
 }