Пример #1
0
        /// <summary>
        /// This is the main game update logic section.
        /// The onEnterFrame() handler is in charge of calling this
        /// the appropriate number of times each frame.
        /// This block handles state changes, replays, all that good stuff.
        /// </summary>
        protected internal void Step()
        {
            if (RequestedReset)
            {
                RequestedReset = false;
                // flx# - create new instance from initialState, otherwise this wont work...
                RequestedState = InitialState;
                //_replayTimer = 0;
                //_replayCancelKeys = null;
                FlxG.reset();
            }

            // handle replay-related requests

            /*
             * if (_recordingRequested)
             * {
             *  _recordingRequested = false;
             *  _replay.create(FlxG.globalSeed);
             *  _recording = true;
             *  if (_debugger != null)
             *  {
             *      _debugger.vcr.recording();
             *      FlxG.log("FLIXEL: starting new flixel gameplay record.");
             *  }
             * }
             * else if (_replayRequested)
             * {
             *  _replayRequested = false;
             *  _replay.rewind();
             *  FlxG.globalSeed = _replay.seed;
             *  if (_debugger != null)
             *      _debugger.vcr.playing();
             *  _replaying = true;
             * }
             */

            // handle state switching requests
            if (State != RequestedState)
            {
                switchState();
            }

            // finally actually step through the game physics
            FlxBasic.activeCount = 0;

            /*
             * if(_replaying)
             *          {
             *                  _replay.playNextFrame();
             *                  if(_replayTimer > 0)
             *                  {
             *                          _replayTimer -= _step;
             *                          if(_replayTimer <= 0)
             *                          {
             *                                  if(_replayCallback != null)
             *                                  {
             *                                          _replayCallback();
             *                                          _replayCallback = null;
             *                                  }
             *                                  else
             *                                          FlxG.stopReplay();
             *                          }
             *                  }
             *                  if(_replaying && _replay.finished)
             *                  {
             *                          FlxG.stopReplay();
             *                          if(_replayCallback != null)
             *                          {
             *                                  _replayCallback();
             *                                  _replayCallback = null;
             *                          }
             *                  }
             *                  if(_debugger != null)
             *                          _debugger.vcr.updateRuntime(_step);
             *          }
             *          else
             */
            {
                FlxG.updateInput();
            }

            /*
             *          if(_recording)
             *          {
             *                  _replay.recordFrame();
             *                  if(_debugger != null)
             *                          _debugger.vcr.updateRuntime(_step);
             *          }
             */

            update();
            FlxG.mouse.wheel = 0;
            //if (_debuggerUp)
            //    _debugger.perf.activeObjects(FlxBasic._ACTIVECOUNT);
        }