public Task StartAsync(CancellationToken cancellationToken) { IGameNotificationManager gameNotificationManager = _serviceProvider.GetService <IGameNotificationManager>(); _gameLoop = new GameLoop(100); Thread t = new Thread(() => _gameLoop.Start(_serviceProvider, gameNotificationManager).ConfigureAwait(false)); t.Start(); return(Task.CompletedTask); }
public async Task Start(IServiceProvider serviceProvider, IGameNotificationManager gameNotificationManager) { Game.SetServiceProvider(serviceProvider); Game.SetNotificationManager(gameNotificationManager); Running = true; DateTime previouseLoopTime = DateTime.Now; DateTime time; while (Running) { time = DateTime.Now; if ((time - previouseLoopTime).TotalMilliseconds > LoopIntervalMiliseconds) { previouseLoopTime = time; await Game.Instance.Update(); } } }
public EventService(IGameNotificationManager NotificationManager) { _NotificationManager = NotificationManager; }
public void SetNotificationManager(IGameNotificationManager notificationManager) { _notificationManager = notificationManager; }