当前位置: 首页>>代码示例>>C#>>正文


C# Level.Reset方法代码示例

本文整理汇总了C#中Level.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# Level.Reset方法的具体用法?C# Level.Reset怎么用?C# Level.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Level的用法示例。


在下文中一共展示了Level.Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        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 (_mControls.IsBPressed(false) || _mControls.IsBackPressed(false))
            {
                _mCurrent = 0;
                gameState = GameStates.InGame;

                _mItems[0] = _mResumeSel;
                _mItems[1] = _mRestartUnsel;
                _mItems[2] = _mSelectLevelUnsel;
                _mItems[3] = _mMainMenuUnsel;
            }
            /* If the user selects a menu item */
            if (_mControls.IsAPressed(false) || _mControls.IsStartPressed(false))
            {
                 GameSound.MenuSoundSelect.Play(GameSound.Volume, 0.0f, 0.0f);
                /* Resume Game */
                 if (_mCurrent == 0)
                     gameState = GameStates.InGame;
                 /* Restart */
                 else if (_mCurrent == 1)
                 {
                     level.ResetAll();
                     gameState = GameStates.StartLevelSplash;
                     _mCurrent = 0;
                 }
                 /* Select Level */
                 else if (_mCurrent == 2)
                 {
                     gameState = GameStates.LevelSelection;
                     level.Reset();
                     _mCurrent = 0;
                 }
                 /* Main Menu */
                 else if (_mCurrent == 3)
                 {
                     gameState = GameStates.MainMenu;
                     level.Reset();
                     _mCurrent = 0;
                 }

                 _mItems[0] = _mResumeSel;
                 _mItems[1] = _mRestartUnsel;
                 _mItems[2] = _mSelectLevelUnsel;
                 _mItems[3] = _mMainMenuUnsel;
            }
        }
开发者ID:DizWARE,项目名称:Mr-Gravity,代码行数:75,代码来源:Pause.cs

示例2: levelCompleteHandler

 private void levelCompleteHandler(Level target)
 {
     Utils.trace(target, "levelComplete");
     //SetEventHandlers(target, false);
     target.Reset();
 }
开发者ID:Wttewaall,项目名称:3dhype-gamejam,代码行数:6,代码来源:Game.cs


注:本文中的Level.Reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。