Fxed an issue with random encounters, added a repeatable property, add event for abandoning encounters
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Jovian.EncounterSystem {
|
||||
public event Action<IEncounter> QuestStarted;
|
||||
public event Action<IEncounter, IEncounter> QuestAdvanced;
|
||||
public event Action<IEncounter> QuestCompleted;
|
||||
public event Action<IEncounter> QuestAbandoned;
|
||||
|
||||
public IReadOnlyCollection<string> ResolvedIds => resolvedIds;
|
||||
|
||||
@@ -76,6 +77,19 @@ namespace Jovian.EncounterSystem {
|
||||
}
|
||||
}
|
||||
|
||||
public void OnEncounterAbandoned(IEncounter encounter) {
|
||||
if(encounter?.EncounterDefinition.Kind is not QuestKind questKind) {
|
||||
return;
|
||||
}
|
||||
|
||||
var id = encounter.EncounterDefinition?.internalId;
|
||||
if(string.IsNullOrEmpty(id) || !resolvedIds.Remove(id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
QuestAbandoned?.Invoke(encounter);
|
||||
}
|
||||
|
||||
public void LoadResolvedIds(IEnumerable<string> ids) {
|
||||
resolvedIds.Clear();
|
||||
if(ids == null) {
|
||||
|
||||
Reference in New Issue
Block a user