Code: Select all
protected virtual void VerifyTrueNodeChildrenAreActive()
{
// Create a copy of the quest list to iterate over safely
var questListCopy = new List<Quest>(questList);
foreach (var quest in questListCopy)
{
// Only process active quests
if (quest.GetState() != QuestState.Active) continue;
var processed = new HashSet<QuestNode>();
foreach (var node in quest.nodeList)
{
if (processed.Contains(node)) continue;
processed.Add(node);
// Check for True nodes
if (node.GetState() == QuestNodeState.True)
{
foreach (var child in node.childList)
{
// Activate inactive children
if (child.GetState() == QuestNodeState.Inactive)
{
child.SetState(QuestNodeState.Active);
}
}
}
}
}
}