Beispiel #1
0
        private void InitializeBeforeRun()
        {
            try
            {
                using (var profile = Profiler.Begin(GameProfilingKeys.GameInitialize))
                {
                    // Initialize this instance and all game systems before trying to create the device.
                    Initialize();

                    _gameEngine.LoadContent();

                    IsRunning = true;

                    BeginRun();

                    _autoTickTimer.Reset();
                    _updateTime.Reset(_updateTime.Total);

                    // Run the first time an update
                    using (Profiler.Begin(GameProfilingKeys.GameUpdate))
                    {
                        _gameEngine.InitialUpdate();
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Unexpected exception.", ex);
                throw;
            }
        }
Beispiel #2
0
 internal void Reset()
 {
     _physicsGameTime.Reset(TimeSpan.Zero);
     SimulationTickNumber   = default;
     CurrentTickTimeElapsed = TimeSpan.Zero;
     TotalTime = TimeSpan.Zero;
 }