public virtual void DeleteQuest(Quest quest) { if (quest == null) { return; } questList.Remove(quest); if (!quest.isProcedurallyGenerated) { var questID = StringField.GetStringValue(quest.id); if (!deletedStaticQuests.Contains(questID)) { deletedStaticQuests.Add(questID); } } UnregisterForQuestEvents(quest); QuestMachine.UnregisterQuestInstance(quest); Quest.DestroyInstance(quest); }
private void OnDestroy() { if (isInstance && Application.isPlaying) { QuestMachine.UnregisterQuestInstance(this); SetState(QuestState.Disabled); if (autostartConditionSet != null) { autostartConditionSet.DestroySubassets(); } if (offerConditionSet != null) { offerConditionSet.DestroySubassets(); } QuestSubasset.DestroyList(offerConditionsUnmetContentList); QuestSubasset.DestroyList(offerContentList); QuestStateInfo.DestroyListSubassets(stateInfoList); QuestNode.DestroyListSubassets(nodeList); } }