fr.jeanf.questsystem 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -34,6 +34,9 @@ namespace jeanf.questsystem
|
|
|
34
34
|
private StringFloatEventChannelSO QuestProgress;
|
|
35
35
|
private StringEventChannelSO StartQuestEventChannel;
|
|
36
36
|
|
|
37
|
+
[Header("Broadcasting on:")] [SerializeField]
|
|
38
|
+
private StringEventChannelSO requirementCheck;
|
|
39
|
+
|
|
37
40
|
public void OnValidate()
|
|
38
41
|
{
|
|
39
42
|
const string searching = "attempting to find";
|
|
@@ -60,7 +63,15 @@ namespace jeanf.questsystem
|
|
|
60
63
|
questId = questInfoForPoint.id;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
private void OnEnable()
|
|
66
|
+
private void OnEnable()
|
|
67
|
+
{
|
|
68
|
+
Subscribe();
|
|
69
|
+
|
|
70
|
+
requirementCheck.RaiseEvent(questId);
|
|
71
|
+
if (!_startQuestOnEnable) return;
|
|
72
|
+
RequestQuestStart(questId);
|
|
73
|
+
}
|
|
74
|
+
|
|
64
75
|
private void OnDisable() => Unsubscribe();
|
|
65
76
|
private void OnDestroy() => Unsubscribe();
|
|
66
77
|
|
|
@@ -90,6 +101,12 @@ namespace jeanf.questsystem
|
|
|
90
101
|
|
|
91
102
|
if (isDebug) Debug.Log($"All is clear, continuing ...");
|
|
92
103
|
|
|
104
|
+
if (currentQuestState.Equals(QuestState.REQUIREMENTS_NOT_MET) && _startQuestOnEnable)
|
|
105
|
+
{
|
|
106
|
+
if(isDebug) Debug.Log($"forcing start of quest: {questId}");
|
|
107
|
+
GameEventsManager.instance.questEvents.StartQuest(questId);
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
// start or finish a quest
|
|
94
111
|
if (currentQuestState.Equals(QuestState.CAN_START))
|
|
95
112
|
{
|
|
@@ -118,15 +135,14 @@ namespace jeanf.questsystem
|
|
|
118
135
|
if (quest.info.id.Equals(questId))
|
|
119
136
|
{
|
|
120
137
|
currentQuestState = quest.state;
|
|
121
|
-
|
|
122
|
-
// start on enable option
|
|
123
|
-
if (_startQuestOnEnable && quest.state == QuestState.CAN_START) RequestQuestStart(quest.info.id);
|
|
124
138
|
}
|
|
125
139
|
}
|
|
126
140
|
|
|
127
141
|
public void AllClear(bool value)
|
|
128
142
|
{
|
|
129
143
|
clearToStart = value;
|
|
144
|
+
currentQuestState = QuestState.CAN_START;
|
|
145
|
+
requirementCheck.RaiseEvent(questId);
|
|
130
146
|
UpdateState();
|
|
131
147
|
}
|
|
132
148
|
|
|
@@ -24,6 +24,8 @@ namespace jeanf.questsystem
|
|
|
24
24
|
private StringEventChannelSO questStatusUpdateChannel;
|
|
25
25
|
private StringFloatEventChannelSO questProgress;
|
|
26
26
|
|
|
27
|
+
[Header("Listening on:")] [SerializeField] private StringEventChannelSO questStatusUpdateRequested;
|
|
28
|
+
|
|
27
29
|
private Dictionary<string, Quest> questMap;
|
|
28
30
|
|
|
29
31
|
// quest start requirements
|
|
@@ -43,6 +45,8 @@ namespace jeanf.questsystem
|
|
|
43
45
|
GameEventsManager.instance.questEvents.onQuestStepStateChange += QuestStepStateChange;
|
|
44
46
|
|
|
45
47
|
GameEventsManager.instance.playerEvents.onPlayerLevelChange += PlayerLevelChange;
|
|
48
|
+
|
|
49
|
+
questStatusUpdateRequested.OnEventRaised += ctx => CheckRequirementsMet(questMap[ctx]);
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
private void OnDisable()
|
|
@@ -97,6 +101,8 @@ namespace jeanf.questsystem
|
|
|
97
101
|
meetsRequirements = false;
|
|
98
102
|
}
|
|
99
103
|
}
|
|
104
|
+
|
|
105
|
+
if(isDebug) Debug.Log($"checking requirements for quest: {quest.info.name}, [{quest.info.id}], meetsRequirements: {meetsRequirements}");
|
|
100
106
|
|
|
101
107
|
return meetsRequirements;
|
|
102
108
|
}
|