File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,8 @@ public Quest()
145145 poi . UIPrefab = uiPrefabObject ;
146146#endif
147147 S1Quest . PoIPrefab = poiPrefabObject ;
148+
149+ S1Quest . onQuestEnd . AddListener ( ( UnityAction < S1Quests . EQuestState > ) OnQuestEnded ) ;
148150 }
149151
150152 /// <summary>
@@ -156,7 +158,7 @@ internal override void CreateInternal()
156158
157159 base . CreateInternal ( ) ;
158160
159- // Initialize the quest
161+ // Initialize the quest
160162 S1Quest . InitializeQuest ( Title , Description , Array . Empty < S1Data . QuestEntryData > ( ) , S1Quest ? . StaticGUID ) ;
161163
162164 if ( AutoBegin )
@@ -172,6 +174,17 @@ internal override void SaveInternal(string folderPath, ref List<string> extraSav
172174 base . SaveInternal ( questDataPath , ref extraSaveables ) ;
173175 }
174176
177+ /// <summary>
178+ /// INTERNAL: Called when the quest ends
179+ /// </summary>
180+ /// <param name="questState">The state it ended in.</param>
181+ internal void OnQuestEnded ( S1Quests . EQuestState questState )
182+ {
183+ // Cleanup our quest in the API manager as well as game quests list
184+ S1Quests . Quest . Quests . Remove ( S1Quest ) ;
185+ QuestManager . Quests . Remove ( this ) ;
186+ }
187+
175188 /// <summary>
176189 /// Adds a new quest entry to the quest.
177190 /// </summary>
You can’t perform that action at this time.
0 commit comments