MrGravity.Level.Reset C# (CSharp) Méthode

Reset() public méthode

Preps the level to reload content
public Reset ( ) : void
Résultat void
        public void Reset()
        {
            _mPhysicsEnvironment.GravityDirection = GravityDirections.Down;
            _mObjects.Clear();
            _mCollected.Clear();
            _mRemoveCollected.Clear();
            _mTrigger.Clear();
            MTimer = 0;
            if (_mPlayer != null)
            {
                _mPlayer.ResetIdle((int)MTimer, _mPhysicsEnvironment.GravityDirection);
            }

            if (_mPlayerEnd != null)
            {
                _mPlayerEnd.UpdateFace(MTimer);
            }

            ResetScores();
        }

Usage Example

Exemple #1
0
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level level)
        {
            /* If the user hits up */
            if (_mControls.IsUpPressed(false))
            {
                /* If we are not on the first element already */
                if (_mCurrent > 0)
                {
                    GameSound.MenuSoundRollover.Play(GameSound.Volume, 0.0f, 0.0f);
                    /* Decrement current and change the images */
                    _mCurrent--;
                    for (var i = 0; i < NumOptions; i++)
                        _mItems[i] = _mUnselItems[i];
                    _mItems[_mCurrent] = _mSelItems[_mCurrent];
                }
            }
            /* If the user hits the down button */
            if (_mControls.IsDownPressed(false))
            {
                /* If we are on the last element in the menu */
                if (_mCurrent < NumOptions - 1)
                {
                    GameSound.MenuSoundRollover.Play(GameSound.Volume, 0.0f, 0.0f);
                    /* Increment current and update graphics */
                    _mCurrent++;
                    for (var i = 0; i < NumOptions; i++)
                        _mItems[i] = _mUnselItems[i];
                    _mItems[_mCurrent] = _mSelItems[_mCurrent];
                }
            }
            /* If the user selects a menu item */
            if (_mControls.IsAPressed(false) || _mControls.IsStartPressed(false))
            {
                GameSound.MenuSoundSelect.Play(GameSound.Volume, 0.0f, 0.0f);
                /* Continue */
                if (_mCurrent == 0)
                {
                    gameState = GameStates.NewLevelSelection;
                    level.Reset();
                    _mCurrent = 1;

                    for (var i = 0; i < NumOptions; i++)
                        _mItems[i] = _mUnselItems[i];
                    _mItems[_mCurrent] = _mSelItems[_mCurrent];
                }
                /* Back */
                else if (_mCurrent == 1)
                {
                    gameState = GameStates.Options;

                }
            }
            if (_mControls.IsBPressed(false) || _mControls.IsBackPressed(false))
                gameState = GameStates.Options;
        }