void StartStory(StorySO currentStory, UI.StoryState state = UI.StoryState.New) { if (m_CurrentStory == currentStory) { return; } m_CurrentStory = currentStory; m_CurrentTaskIndex = 0; m_CurrentTaskIndex = m_CurrentStory.Tasks.FindIndex(o => o.IsDone == false); if (m_CurrentTaskIndex >= 0) { StartTask(); } if (startStoryEvent != null) { storyLog.Add(m_CurrentStory); startStoryEvent.RaiseEvent(m_CurrentStory); } navigationInteractionUI.RaiseEvent(true, new StoryInfo { // this is a new quest so grab the first quest. Story = m_CurrentStory, Index = m_CurrentTaskIndex, State = state }, InteractionType.Navigate); }
public bool Contains(StorySO story) { if (!storyCategories.Contains(story.TypeId)) { return(false); } return(stories.Find(s => s == story) != null); }
public void Add(StorySO story) { if (!storyCategories.Contains(story.TypeId)) { storyCategories.Add(story.TypeId); stories.Add(story); return; } if (!Contains(story)) { stories.Add(story); } }
public void Remove(StorySO story) { if (!storyCategories.Contains(story.TypeId)) { return; } if (stories.Count <= 0) { return; } foreach (var currentStory in stories) { if (currentStory == story) { stories.Remove(currentStory); return; } } }
void StartGame() { // TODO Add code for saved information // TODO add check for active quest. // Start the main story of the game. if (currentStoryLine != null) { if (currentStoryLine.Stories.Exists(o => !o.IsDone)) { m_CurrentQuestLineIndex = currentStoryLine.Stories.FindIndex(o => !o.IsDone); if (m_CurrentQuestLineIndex >= 0) { m_CurrentStory = currentStoryLine.Stories.Find(o => !o.IsDone); } // if we found a quest line. fetch the first quest. m_CurrentQuestIndex = currentStoryLine.Stories.FindIndex(o => o.IsDone == false); if (m_CurrentQuestIndex >= 0) { StartStory(currentStoryLine.Stories[m_CurrentQuestIndex]); } } } }