fr.jeanf.questsystem 0.1.4 → 0.1.6
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,7 +34,8 @@ namespace jeanf.questsystem
|
|
|
34
34
|
|
|
35
35
|
#region step trigger and completion
|
|
36
36
|
[Header("Quest Step Progression events & Variables")]
|
|
37
|
-
public List<QuestStep>
|
|
37
|
+
public List<QuestStep> questStepsTriggeredOnCompletion = new List<QuestStep>();
|
|
38
|
+
public List<QuestStep> questStepsTriggeredOnFailure = new List<QuestStep>();
|
|
38
39
|
public delegate void SendNextStepId(string id);
|
|
39
40
|
public static SendNextStepId sendNextStepId;
|
|
40
41
|
|
|
@@ -119,8 +120,8 @@ namespace jeanf.questsystem
|
|
|
119
120
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
if(isDebug) Debug.Log($"Step with id [{stepId}] has {
|
|
123
|
-
foreach(QuestStep questStep in
|
|
123
|
+
if(isDebug) Debug.Log($"Step with id [{stepId}] has {questStepsTriggeredOnCompletion.Count} childSteps");
|
|
124
|
+
foreach(QuestStep questStep in questStepsTriggeredOnCompletion)
|
|
124
125
|
{
|
|
125
126
|
if(isDebug) Debug.Log($"sending childstep to initialization: {questStep.name}, stepId: [{questStep.stepId}]");
|
|
126
127
|
childStep?.Invoke(questStep);
|
|
@@ -139,9 +140,16 @@ namespace jeanf.questsystem
|
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
|
|
142
|
-
protected void ApplyFailureConsequence()
|
|
143
|
+
protected virtual void ApplyFailureConsequence()
|
|
143
144
|
{
|
|
144
145
|
endStepChannel.RaiseEvent(stepId);
|
|
146
|
+
foreach (QuestStep questStep in questStepsTriggeredOnFailure)
|
|
147
|
+
{
|
|
148
|
+
if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Requesting to start next step: {questStep.stepId}", this);
|
|
149
|
+
|
|
150
|
+
//Si questStep.prerequisitesStep are in QuestItem.stepsCompleted
|
|
151
|
+
sendNextStepId?.Invoke(questStep.stepId);
|
|
152
|
+
}
|
|
145
153
|
}
|
|
146
154
|
public void FinishQuestStep()
|
|
147
155
|
{
|
|
@@ -160,7 +168,7 @@ namespace jeanf.questsystem
|
|
|
160
168
|
if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Sending stepActive Event (delegate) with arguments: {stepId}, {stepStatus} ", this);
|
|
161
169
|
stepActive?.Invoke(stepId, stepStatus);
|
|
162
170
|
|
|
163
|
-
foreach (QuestStep questStep in
|
|
171
|
+
foreach (QuestStep questStep in questStepsTriggeredOnCompletion)
|
|
164
172
|
{
|
|
165
173
|
if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Requesting to start next step: {questStep.stepId}", this);
|
|
166
174
|
|