fr.jeanf.questsystem 0.1.5 → 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> questStepsToTrigger = new 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 {questStepsToTrigger.Count} childSteps");
123
- foreach(QuestStep questStep in questStepsToTrigger)
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);
@@ -142,6 +143,13 @@ namespace jeanf.questsystem
142
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 questStepsToTrigger)
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.questsystem",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "displayName": "Quest system",
5
5
  "description": "This package uses Scriptable Objects to define quests.",
6
6
  "unity": "2021.3",