// If there are multiple, will return the first foundpublicGameQuestGetInProgress(string uid) public GameQuest GetSucceeded(string uid) public GameQuest GetFailed(string uid) public GameQuest GetCompleted(string uid) // returns true or false, with the found GameQuest in the out valuepublic bool TryGetInProgress(string uid,outGameQuest found)public bool TryGetSucceeded(string uid,outGameQuest found)public bool TryGetFailed(string uid,outGameQuest found)public bool TryGetCompleted(string uid,outGameQuest found)
Get IEnumerable<GameQuest> results
// These can be turned into a List<GameQuest> or GameQuest[], or further queried using// LINQ.public IEnumerable<GameQuest> QuestsModifyingStatspublic IEnumerable<GameQuest> QuestsInProgresspublic IEnumerable<GameQuest> QuestsSucceededpublic IEnumerable<GameQuest> QuestsFailedpublic IEnumerable<GameQuest> QuestsCompleted// Exampleforeach(var gameQuest ingameQuestList.QuestsModifyingStats)Debug.Log($"{gameQuest.ObjectName()} is modifying {gameQuest.DirectlyAffectsList().Count} stats");List<GameQuest> completedQuests =gameQuestList.QuestsCompleted.ToList();GameQuest[] questsInProgress =gameQuestList.QuestsInProgress.ToArray();
Additional Get Methods
// Get all GameQuests that are affecting Stats. Returns IEnumberable<GameQuest>List<GameStat> StatAffectingQuests =>gameQuestList.QuestsModifyingStats.ToList();// Get GameQuests that are affecting stats and no longer in progress, using LINQList<GameStat> CompletedQuestsAffectingStats =>gameQuestList.QuestsModifyingStats .Where(x =>x.status!=QuestStep.QuestStepStatus.InProgress).ToList();
Examples
You can Get and TryGet quests based on their status.
// These will return a single GameQuest, or nullGameQuestInProgress(string uid) =>gameQuestList.GetInProgress(uid);GameQuestSucceeded(string uid) =>gameQuestList.GetInProgress(uid);GameQuestFailed(string uid) =>gameQuestList.GetInProgress(uid);GameQuestCompleted(string uid) =>gameQuestList.GetCompleted(uid);if (TryGetInProgress(uid,outvar gameQuest))Debug.Log($"{gameQuest.ObjectName()} is in progress");if (TryGetSucceeded(uid,outvar gameQuest))Debug.Log($"{gameQuest.ObjectName()} has succeeded");if (TryGetFailed(uid,outvar gameQuest))Debug.Log($"{gameQuest.ObjectName()} has failed");if (TryGetCompleted(uid,outvar gameQuest))Debug.Log($"{gameQuest.ObjectName()} has been completed, no longer in progress");
You can also get an IEnumerable<GameQuest> based on the status of the quests. This can be turned into a List, Array, or have further logic applied prior to being used as a List or Array.