Ejemplo n.º 1
0
        public GameLoop(
            ICoreDiagnosticInfoProvider coreDiagnosticInfoProvider,
            IGameTimeProvider gameTimeProvider,
            IEngineSystems engineSystems,
            ISceneManagerForGameLoop sceneManager,
            IPerformanceStatisticsRecorder performanceStatisticsRecorder,
            CoreConfiguration configuration)
        {
            _coreDiagnosticInfoProvider = coreDiagnosticInfoProvider;
            _gameTimeProvider           = gameTimeProvider;
            _engineSystems = engineSystems;
            _sceneManager  = sceneManager;
            _performanceStatisticsRecorder = performanceStatisticsRecorder;

            _fixedUpdatesPerFrameLimit = configuration.FixedUpdatesPerFrameLimit;
        }
        public PerformanceStatisticsStorage(IEngineSystems engineSystems)
        {
            var systemsFramesField = new Dictionary <string, CircularBuffer <Frame> >();

            _systemsFrames = systemsFramesField;

            var systemsFramesProperty = new Dictionary <string, IReadOnlyCollection <Frame> >();

            SystemsFrames = systemsFramesProperty;

            var currentSystemsFrames = new Dictionary <string, TimeSpan>();

            _currentSystemsFrameTimes = currentSystemsFrames;

            _systemsNames = engineSystems.SystemsNames;
            foreach (var systemName in _systemsNames)
            {
                var circularBuffer = new CircularBuffer <Frame>(CircularBufferSize);
                systemsFramesField.Add(systemName, circularBuffer);
                systemsFramesProperty.Add(systemName, circularBuffer);
                currentSystemsFrames.Add(systemName, TimeSpan.Zero);
            }
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            _coreDiagnosticInfoProvider = Substitute.For <ICoreDiagnosticInfoProvider>();
            _gameTimeProvider           = Substitute.For <IGameTimeProvider>();
            _engineSystems = Substitute.For <IEngineSystems>();
            _sceneManager  = Substitute.For <ISceneManagerForGameLoop>();
            _performanceStatisticsRecorder = Substitute.For <IPerformanceStatisticsRecorder>();

            _animationSystem = Substitute.For <IAnimationSystem>();
            _engineSystems.AnimationSystem.Returns(_animationSystem);
            _engineSystems.AnimationSystemName.Returns(AnimationSystemName);
            _audioSystem = Substitute.For <IAudioSystem>();
            _engineSystems.AudioSystem.Returns(_audioSystem);
            _engineSystems.AudioSystemName.Returns(AudioSystemName);
            _behaviorSystem = Substitute.For <IBehaviorSystem>();
            _engineSystems.BehaviorSystem.Returns(_behaviorSystem);
            _engineSystems.BehaviorSystemName.Returns(BehaviorSystemName);
            _entityDestructionSystem = Substitute.For <IEntityDestructionSystem>();
            _engineSystems.EntityDestructionSystem.Returns(_entityDestructionSystem);
            _engineSystems.EntityDestructionSystemName.Returns(EntityDestructionSystemName);
            _inputSystem = Substitute.For <IInputSystem>();
            _engineSystems.InputSystem.Returns(_inputSystem);
            _engineSystems.InputSystemName.Returns(InputSystemName);
            _physicsSystem = Substitute.For <IPhysicsSystem>();
            _engineSystems.PhysicsSystem.Returns(_physicsSystem);
            _engineSystems.PhysicsSystemName.Returns(PhysicsSystemName);
            _renderingSystem = Substitute.For <IRenderingSystem>();
            _engineSystems.RenderingSystem.Returns(_renderingSystem);
            _engineSystems.RenderingSystemName.Returns(RenderingSystemName);
            _customSystem1 = Substitute.For <ICustomSystem>();
            _customSystem1.Name.Returns(CustomSystem1Name);
            _customSystem2 = Substitute.For <ICustomSystem>();
            _customSystem2.Name.Returns(CustomSystem2Name);
            _customSystem3 = Substitute.For <ICustomSystem>();
            _customSystem3.Name.Returns(CustomSystem3Name);
            _engineSystems.CustomSystems.Returns(new[] { _customSystem1, _customSystem2, _customSystem3 });
        }
 public void SetUp()
 {
     _engineSystems = Substitute.For <IEngineSystems>();
 }