private void StartNextQuestEvent() { m_CurrentQuestEventData++; QuestEventData eventData = m_QuestEventDataList[m_CurrentQuestEventData]; int seconds = UnityEngine.Random.Range(eventData.minTime, eventData.maxTime + 1); m_QuestEventTimeTracker = ServiceLocator.TimeService.GetTimeTracker(seconds); m_QuestEventTimeTracker.OnTimerCompleted += OnQuestEventTimerComplete; }
private void OnQuestEventTimerComplete() { m_QuestEventTimeTracker.OnTimerCompleted -= OnQuestEventTimerComplete; QuestEventData eventData = m_QuestEventDataList[m_CurrentQuestEventData]; bool spawnQuest = UnityEngine.Random.Range(0, 101) < eventData.chance; if (spawnQuest) { for (int i = 0; i < eventData.questCount; i++) { QuestInstance quest = QuestGenerator.GenerateQuest(1, m_QuestMakeupRandom.GetRandomValue()); FactionInstance faction = ServiceLocator.AllegianceService.Factions.GetRandom(); ServiceLocator.QuestService.RegisterQuest(quest, faction); } m_CurrentQuestEventData = -1; } StartNextQuestEvent(); }