fr.jeanf.questsystem 0.1.7 → 0.1.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.
@@ -75,7 +75,7 @@ namespace jeanf.questsystem
75
75
  questId = questSO.id;
76
76
  for (int i = 0; i < questSO.rootSteps.Length; i++)
77
77
  {
78
- if (isDebug) Debug.Log($"id on awake {questSO.rootSteps[i].StepId}, added to {this.name}'s dictionary", this);
78
+ //if (isDebug) Debug.Log($"id on awake {questSO.rootSteps[i].StepId}, added to {this.name}'s dictionary", this);
79
79
  AddStepToStepMap(questSO.rootSteps[i]);
80
80
  rootSteps.Add(questSO.rootSteps[i]);
81
81
  }
@@ -155,15 +155,15 @@ namespace jeanf.questsystem
155
155
  }
156
156
  private void AddStepToStepMap(QuestStep step)
157
157
  {
158
- if (isDebug) Debug.Log($"--- Received request to add step {step.name} with id: {step.StepId} to stepMap.");
158
+ //if (isDebug) Debug.Log($"--- Received request to add step {step.name} with id: {step.StepId} to stepMap.");
159
159
  if (!stepMap.ContainsKey(step.StepId))
160
160
  {
161
- if (isDebug) Debug.Log($"--- Step [{step.StepId}] not found in stepMap, adding it.");
161
+ //if (isDebug) Debug.Log($"--- Step [{step.StepId}] not found in stepMap, adding it.");
162
162
  stepMap.Add(step.StepId, step);
163
163
  }
164
164
  if (completedSteps.ContainsKey(step.StepId))
165
165
  {
166
- if (isDebug) Debug.Log($"--- Step [{step.StepId}] already completed removing it from completeSteps so that we can go through it again.");
166
+ //if (isDebug) Debug.Log($"--- Step [{step.StepId}] already completed removing it from completeSteps so that we can go through it again.");
167
167
  completedSteps.Remove(step.StepId);
168
168
  }
169
169
  }
@@ -185,7 +185,7 @@ namespace jeanf.questsystem
185
185
  completedSteps.Clear();
186
186
  completedSteps.TrimExcess();
187
187
 
188
- if (isDebug) Debug.Log($"Quest [{id}]: _startQuestOnEnable value is: [{_startQuestOnEnable}]");
188
+ //if (isDebug) Debug.Log($"Quest [{id}]: _startQuestOnEnable value is: [{_startQuestOnEnable}]");
189
189
  if (!_startQuestOnEnable || id != questId) return;
190
190
  clearToStart = true;
191
191
  currentQuestState = QuestState.CAN_START;
@@ -221,28 +221,28 @@ namespace jeanf.questsystem
221
221
  }
222
222
  private void UpdateState()
223
223
  {
224
- if (isDebug) Debug.Log($"Updating State...");
224
+ //if (isDebug) Debug.Log($"Updating State...");
225
225
  if (!clearToStart) return;
226
- if (isDebug) Debug.Log($"All is clear, continuing ...");
226
+ //if (isDebug) Debug.Log($"All is clear, continuing ...");
227
227
 
228
228
  switch (currentQuestState)
229
229
  {
230
230
  case QuestState.CAN_START:
231
231
  {
232
- if (isDebug) Debug.Log($"Starting quest: {questId}");
232
+ //if (isDebug) Debug.Log($"Starting quest: {questId}");
233
233
  GameEventsManager.instance.questEvents.StartQuest(questId);
234
234
  break;
235
235
  }
236
236
  case QuestState.CAN_FINISH:
237
237
  {
238
- if (isDebug) Debug.Log($"Finishing quest: {questId}");
238
+ //if (isDebug) Debug.Log($"Finishing quest: {questId}");
239
239
  GameEventsManager.instance.questEvents.FinishQuest(questId);
240
240
  break;
241
241
  }
242
242
  case QuestState.REQUIREMENTS_NOT_MET:
243
243
  if (_startQuestOnEnable)
244
244
  {
245
- if (isDebug) Debug.Log($"forcing start of quest: {questId}");
245
+ //if (isDebug) Debug.Log($"forcing start of quest: {questId}");
246
246
  GameEventsManager.instance.questEvents.StartQuest(questId);
247
247
  }
248
248
  break;
@@ -258,7 +258,7 @@ namespace jeanf.questsystem
258
258
  {
259
259
  if (id != questId) return;
260
260
  this.progress = progress;
261
- if (isDebug) Debug.Log($"questid [{id}] progress = {progress * 100}%");
261
+ //if (isDebug) Debug.Log($"questid [{id}] progress = {progress * 100}%");
262
262
  }
263
263
  private void QuestStateChange(Quest quest)
264
264
  {
@@ -294,10 +294,10 @@ namespace jeanf.questsystem
294
294
  }
295
295
  public void LogActiveSteps()
296
296
  {
297
- Debug.Log($"There is {activeSteps.Count} active steps at the moment.");
297
+ //Debug.Log($"There is {activeSteps.Count} active steps at the moment.");
298
298
  foreach (var step in activeSteps.Keys)
299
299
  {
300
- Debug.Log($"active step: {step}");
300
+ //Debug.Log($"active step: {step}");
301
301
  }
302
302
  }
303
303
  #endif
@@ -316,7 +316,7 @@ namespace jeanf.questsystem
316
316
 
317
317
  if (QuestInitialCheck == null)
318
318
  {
319
- if (isDebug) Debug.Log($"{searching} {_}/QuestInitialCheck in {searchLocation} ", this);
319
+ //if (isDebug) Debug.Log($"{searching} {_}/QuestInitialCheck in {searchLocation} ", this);
320
320
  QuestInitialCheck = Resources.Load<StringEventChannelSO>($"{_}/QuestInitialCheck");
321
321
  if (QuestInitialCheck == null)
322
322
  {
@@ -329,7 +329,7 @@ namespace jeanf.questsystem
329
329
 
330
330
  if (questSO == null)
331
331
  {
332
- if (isDebug) Debug.Log($"There is no questSO in the questItem");
332
+ //if (isDebug) Debug.Log($"There is no questSO in the questItem");
333
333
  validityCheck = false;
334
334
  invalidObjects.Add(questSO);
335
335
  }
@@ -337,7 +337,7 @@ namespace jeanf.questsystem
337
337
 
338
338
  if (QuestProgress == null)
339
339
  {
340
- if (isDebug) Debug.Log($"{searching} {_}/QuestsProgressChannel in {searchLocation} ", this);
340
+ //if (isDebug) Debug.Log($"{searching} {_}/QuestsProgressChannel in {searchLocation} ", this);
341
341
  QuestProgress = Resources.Load<StringFloatEventChannelSO>($"{_}/QuestsProgressChannel");
342
342
  if (QuestProgress == null)
343
343
  {
@@ -350,7 +350,7 @@ namespace jeanf.questsystem
350
350
 
351
351
  if (loadRequiredScenesEventChannel == null)
352
352
  {
353
- if (isDebug) Debug.Log($"{searching} {_}/loadRequiredScenesEventChannel in {searchLocation} ", this);
353
+ //if (isDebug) Debug.Log($"{searching} {_}/loadRequiredScenesEventChannel in {searchLocation} ", this);
354
354
  loadRequiredScenesEventChannel = Resources.Load<StringListEventChannelSO>($"{_}/LoadRequiredScenesEventChannel");
355
355
  if (loadRequiredScenesEventChannel == null)
356
356
  {
@@ -363,7 +363,7 @@ namespace jeanf.questsystem
363
363
 
364
364
  if (requirementCheck == null)
365
365
  {
366
- if (isDebug) Debug.Log($"{searching} {_}/QuestRequirementCheck in {searchLocation}", this);
366
+ //if (isDebug) Debug.Log($"{searching} {_}/QuestRequirementCheck in {searchLocation}", this);
367
367
  requirementCheck = Resources.Load<StringEventChannelSO>($"{_}/QuestRequirementCheck");
368
368
  if (requirementCheck == null)
369
369
  {
@@ -212,7 +212,7 @@ namespace jeanf.questsystem
212
212
  //quest.GetQuestData();
213
213
  // serialize using JsonUtility, but use whatever you want here (like JSON.NET)
214
214
  string serializedData = JsonUtility.ToJson(questData);
215
- Debug.Log($"saved data {serializedData}");
215
+ //if(isDebug) Debug.Log($"saved data {serializedData}");
216
216
  // saving to PlayerPrefs is just a quick example for this tutorial video,
217
217
  // you probably don't want to save this info there long-term.
218
218
  // instead, use an actual Save & Load system and write to a file, the cloud, etc..
@@ -220,12 +220,12 @@ namespace jeanf.questsystem
220
220
  }
221
221
  catch (System.Exception e)
222
222
  {
223
- Debug.LogError("Failed to save quest with id " + quest.questSO.id + ": " + e);
223
+ //Debug.LogError("Failed to save quest with id " + quest.questSO.id + ": " + e);
224
224
  }
225
225
  }
226
226
  private Quest LoadQuest(QuestSO questSO)
227
227
  {
228
- Debug.Log($"attempting to load quest with id: [{questSO.id}]");
228
+ //Debug.Log($"attempting to load quest with id: [{questSO.id}]");
229
229
  var quest = new Quest(questSO);
230
230
  try
231
231
  {
@@ -235,18 +235,18 @@ namespace jeanf.questsystem
235
235
  var serializedData = PlayerPrefs.GetString(questSO.id);
236
236
  var questData = JsonUtility.FromJson<QuestData>(serializedData);
237
237
  quest = new Quest(questSO, questData.state, questData.questStepIndex, questData.questStepStates);
238
- Debug.Log($"loaded previously saved quest with id: [{quest.questSO.id}]");
238
+ //Debug.Log($"loaded previously saved quest with id: [{quest.questSO.id}]");
239
239
  }
240
240
  // otherwise, initialize a new quest
241
241
  else
242
242
  {
243
243
  quest = new Quest(questSO);
244
- Debug.Log($"loaded a fresh instance of quest with id: [{quest.questSO.id}]");
244
+ //Debug.Log($"loaded a fresh instance of quest with id: [{quest.questSO.id}]");
245
245
  }
246
246
  }
247
247
  catch (System.Exception e)
248
248
  {
249
- Debug.LogError($"Failed to load quest with id: [{quest.questSO.id}] - exception: {e}");
249
+ //Debug.LogError($"Failed to load quest with id: [{quest.questSO.id}] - exception: {e}");
250
250
  }
251
251
 
252
252
  return quest;
@@ -103,7 +103,7 @@ namespace jeanf.questsystem
103
103
  // failsafe to avoid lauching the same step more than once at a time.
104
104
  if (stepStatus == QuestStepStatus.Active) return;
105
105
 
106
- if(isDebug) Debug.Log($"Initializing questStep [{stepId}] with for quest with questId: [{questId}]");
106
+ //if(isDebug) Debug.Log($"Initializing questStep [{stepId}] with for quest with questId: [{questId}]");
107
107
 
108
108
  stepStatus = QuestStepStatus.Active;
109
109
  stepActive?.Invoke(stepId, stepStatus);
@@ -115,15 +115,15 @@ namespace jeanf.questsystem
115
115
  }
116
116
  if (isUsingIntroTimeline && timeline)
117
117
  {
118
- if(isDebug) Debug.Log($"sending trigger to timeline: {timeline.name}, triggerValue: true");
118
+ //if(isDebug) Debug.Log($"sending trigger to timeline: {timeline.name}, triggerValue: true");
119
119
  _timelineTriggerEventChannelSo.RaiseEvent(timeline, true);
120
120
 
121
121
  }
122
122
 
123
- if(isDebug) Debug.Log($"Step with id [{stepId}] has {questStepsToTrigger.Count} childSteps");
123
+ //if(isDebug) Debug.Log($"Step with id [{stepId}] has {questStepsToTrigger.Count} childSteps");
124
124
  foreach(QuestStep questStep in questStepsToTrigger)
125
125
  {
126
- if(isDebug) Debug.Log($"sending childstep to initialization: {questStep.name}, stepId: [{questStep.stepId}]");
126
+ //if(isDebug) Debug.Log($"sending childstep to initialization: {questStep.name}, stepId: [{questStep.stepId}]");
127
127
  childStep?.Invoke(questStep);
128
128
  }
129
129
  }
@@ -145,7 +145,7 @@ namespace jeanf.questsystem
145
145
  endStepChannel.RaiseEvent(stepId);
146
146
  foreach (QuestStep questStep in questStepsTriggeredOnFailure)
147
147
  {
148
- if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Requesting to start next step: {questStep.stepId}", this);
148
+ //if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Requesting to start next step: {questStep.stepId}", this);
149
149
 
150
150
  //Si questStep.prerequisitesStep are in QuestItem.stepsCompleted
151
151
  sendNextStepId?.Invoke(questStep.stepId);
@@ -153,31 +153,31 @@ namespace jeanf.questsystem
153
153
  }
154
154
  public void FinishQuestStep()
155
155
  {
156
- if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Changing status to completed", this);
156
+ //if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Changing status to completed", this);
157
157
  stepStatus = QuestStepStatus.Completed;
158
158
 
159
159
  if (sendQuestStepTooltip != null)
160
160
  {
161
- if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Sending tooltip", this);
161
+ //if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Sending tooltip", this);
162
162
  sendQuestStepTooltip.RaiseEvent(string.Empty);
163
163
  }
164
164
 
165
165
 
166
- if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Sending stepCompleted Event (delegate) with argument: {stepId}", this);
166
+ //if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Sending stepCompleted Event (delegate) with argument: {stepId}", this);
167
167
  stepCompleted?.Invoke(stepId);
168
- if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Sending stepActive Event (delegate) with arguments: {stepId}, {stepStatus} ", this);
168
+ //if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Sending stepActive Event (delegate) with arguments: {stepId}, {stepStatus} ", this);
169
169
  stepActive?.Invoke(stepId, stepStatus);
170
170
 
171
171
  foreach (QuestStep questStep in questStepsToTrigger)
172
172
  {
173
- if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Requesting to start next step: {questStep.stepId}", this);
173
+ //if (isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Requesting to start next step: {questStep.stepId}", this);
174
174
 
175
175
  //Si questStep.prerequisitesStep are in QuestItem.stepsCompleted
176
176
  sendNextStepId?.Invoke(questStep.stepId);
177
177
  }
178
178
 
179
179
 
180
- if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Destroying the gameobject with name {this.name}", this);
180
+ //if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Destroying the gameobject with name {this.name}", this);
181
181
  Destroy(this.gameObject);
182
182
  }
183
183
  #endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.questsystem",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "displayName": "Quest system",
5
5
  "description": "This package uses Scriptable Objects to define quests.",
6
6
  "unity": "2021.3",