Ejemplo n.º 1
0
        private void InitializeGame()
        {
            //Initialize game
            World             = new FarseerPhysics.Dynamics.World(Vector2.Zero);
            TimerFactory      = new Timer.Factory();
            AnimationEngine   = new Rendering.Animations.AnimationEngine();
            ParticleEngine    = new Rendering.Particles.ParticleEngine(this);
            EventEngine       = new Core.Events.EventEngine(this);
            SharedRandom      = new Random();
            Diagnostics       = new Diagnostics();
            RPCHelper         = new RPC.RemoteProcedureCallHelper(this);
            LightEngine       = new Rendering.Lighting.LightEngine();
            SoundEngine       = new Sound.SoundEngine(this);
            DiagnosticsParent = "Game Update";

            Gamemode.Create();
            Logger.Info(Strings.Engine.GameCreated + $" ({Gamemode.DisplayName})");
        }
        public virtual void SetupStepTimeMetrics(List <IInterceptor> apiAspects, IMetrics metrics)
        {
            var schedulerFactory = new EventScheduler.Factory();
            var timerFactory     = new Timer.Factory();

            var timer = timerFactory.Create();
            var debugEventAggregator =
                new BatchEventAggregator <DebugEventBatch, DebugEventBatchParams,
                                          DebugEventBatchSummary>(_minimumDebugEventBatchSeparationInMillis,
                                                                  schedulerFactory,
                                                                  timer);
            var debugEventRecorder = new DebugEventRecorder(debugEventAggregator, metrics);

            var timeSource = GetTimeSource();
            var metricsCollectionAspect =
                new MetricsCollectionAspect(debugEventRecorder, timeSource);

            apiAspects.Add(metricsCollectionAspect);
        }
        public ExpressionEvaluationRecorder GetExpressionEvaluationRecorder()
        {
            if (_expressionEvaluationRecorder == null)
            {
                var schedulerFactory = new EventScheduler.Factory();
                var timerFactory     = new Timer.Factory();

                ITimer timer = timerFactory.Create();

                var expressionEvaluationEventAggregator =
                    new BatchEventAggregator <ExpressionEvaluationBatch,
                                              ExpressionEvaluationBatchParams, ExpressionEvaluationBatchSummary>(
                        _minimumDebugEventBatchSeparationInMillis, schedulerFactory, timer);

                _expressionEvaluationRecorder =
                    new ExpressionEvaluationRecorder(expressionEvaluationEventAggregator,
                                                     GetDebugSessionMetrics());
            }

            return(_expressionEvaluationRecorder);
        }