private void LogDamagePlayerEvent(IActor actor, IActor targetActor, ITacticalAct tacticalAct) { // Сервис логирование - необязательная зависимость. // Если он не задан, то не выполняем логирование. if (PlayerEventLogService is null) { return; } // Логируем только урон по персонажу игрока. if (targetActor.Person != PlayerEventLogService.Player.MainPerson) { return; } var damageEvent = new PlayerDamagedEvent(tacticalAct, actor); PlayerEventLogService.Log(damageEvent); }
private async Task StartInternalAsync(IGlobe globe, IAutoplayContext context) { var iterationCounter = 1; while (await context.CheckNextIterationAsync() && iterationCounter <= ITERATION_LIMIT) { for (var updateCounter = 0; updateCounter < GlobeMetrics.OneIterationLength; updateCounter++) { try { await globe.UpdateAsync(CancellationToken.None).ConfigureAwait(false); } catch (ActorTaskExecutionException exception) { CatchActorTaskExecutionException(exception); } catch (AggregateException exception) { CatchException(exception.InnerException); throw; } } iterationCounter++; } if (iterationCounter >= ITERATION_LIMIT) { if (PlayerEventLogService != null) { var endOfLifeEvent = new EndOfLifeEvent(); PlayerEventLogService.Log(endOfLifeEvent); } } ProcessEnd(); }