fr.jeanf.questsystem 0.0.27 → 0.0.28

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.
@@ -21,7 +21,6 @@ namespace jeanf.questsystem
21
21
  public string messageToSendOnInit = "";
22
22
  public bool sendMessageOnFinish = false;
23
23
  public string messageToSendOnFinish = "";
24
-
25
24
  public Quest(QuestInfoSO questInfo)
26
25
  {
27
26
  this.info = questInfo;
@@ -140,7 +140,7 @@ namespace jeanf.questsystem
140
140
 
141
141
  Debug.Log($"Quest [{id}]: _startQuestOnEnable value is: [{_startQuestOnEnable}]");
142
142
  if (!_startQuestOnEnable) return;
143
- RequestQuestStart(questId);
143
+ RequestQuestStart(id);
144
144
  }
145
145
 
146
146
  private void InitialCheckFromQuestManager( string id)
@@ -219,6 +219,7 @@ namespace jeanf.questsystem
219
219
  if (quest.info.id.Equals(questId))
220
220
  {
221
221
  currentQuestState = quest.state;
222
+ UpdateState();
222
223
  }
223
224
  }
224
225
 
@@ -154,8 +154,8 @@ namespace jeanf.questsystem
154
154
  Debug.Log(
155
155
  $"[{quest.info.id}]quest state: {quest.state} - {quest.currentStep} over {quest.info.questStepPrefabs.Length} steps done",
156
156
  this);
157
- questStatusUpdateChannel.RaiseEvent(
158
- $"[{quest.info.id}]quest state: {quest.state} - {quest.currentStep} over {quest.info.questStepPrefabs.Length} steps done");
157
+ questStatusUpdateChannel.RaiseEvent(quest.info.id);
158
+
159
159
 
160
160
 
161
161
  // if there are more steps, instantiate the next one
@@ -187,7 +187,7 @@ namespace jeanf.questsystem
187
187
  UpdateProgress(quest);
188
188
  ClaimRewards(quest);
189
189
  ChangeQuestState(quest.info.id, QuestState.FINISHED);
190
- questStatusUpdateChannel.RaiseEvent($"[{quest.info.id}] quest is finished.");
190
+ questStatusUpdateChannel.RaiseEvent(quest.info.id);
191
191
  questProgress.RaiseEvent(quest.info.id, 1);
192
192
  SaveQuest(quest);
193
193
  if (!quest.sendMessageOnFinish) return;
@@ -4,7 +4,7 @@ MonoImporter:
4
4
  externalObjects: {}
5
5
  serializedVersion: 2
6
6
  defaultReferences: []
7
- executionOrder: 0
7
+ executionOrder: -10
8
8
  icon: {instanceID: 0}
9
9
  userData:
10
10
  assetBundleName:
@@ -28,6 +28,10 @@ namespace jeanf.questsystem
28
28
  [Header("Quest Tooltip")]
29
29
  [SerializeField] private QuestTooltipSO questTooltipSO;
30
30
 
31
+ [Header("Game Objects to Trigger")]
32
+ [SerializeField] QuestInfoSO[] gameObjectsToTriggerOnStart;
33
+ [SerializeField] QuestInfoSO[] gameObjectsToTriggerOnEnd;
34
+
31
35
  public void InitializeQuestStep(string questId, int stepIndex, string questStepState)
32
36
  {
33
37
  this.questId = questId;
@@ -41,11 +45,20 @@ namespace jeanf.questsystem
41
45
  {
42
46
  DisplayActiveQuestStep();
43
47
  }
48
+ if (gameObjectsToTriggerOnStart != null)
49
+ {
50
+ foreach (QuestInfoSO questInfoSO in gameObjectsToTriggerOnStart)
51
+ {
52
+ GameEventsManager.instance.questEvents.StartQuest(questInfoSO.id);
53
+ }
54
+ }
44
55
  if (isUsingIntroTimeline && timeline)
45
56
  {
46
57
  if(isDebug) Debug.Log($"sending trigger to timeline: {timeline.name}, triggerValue: true");
47
58
  _timelineTriggerEventChannelSo.RaiseEvent(timeline, true);
48
59
  }
60
+
61
+
49
62
  }
50
63
 
51
64
  protected void FinishQuestStep()
@@ -59,10 +72,18 @@ namespace jeanf.questsystem
59
72
  if(questId != null) GameEventsManager.instance.questEvents.AdvanceQuest(questId);
60
73
  if(this.gameObject) Destroy(this.gameObject);
61
74
 
75
+ if (gameObjectsToTriggerOnEnd != null)
76
+ {
77
+ foreach (QuestInfoSO questInfoSO in gameObjectsToTriggerOnEnd)
78
+ {
79
+ GameEventsManager.instance.questEvents.StartQuest(questInfoSO.id);
80
+ }
81
+ }
62
82
 
63
83
  if (!isUsingIntroTimeline || !timeline) return;
64
84
  //if(isDebug) Debug.Log($"sending trigger to timeline: {timeline.name}, triggerValue: false");
65
85
  //_timelineTriggerEventChannelSo.RaiseEvent(timeline, false);
86
+
66
87
  }
67
88
 
68
89
  protected void ChangeState(string newState)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"fr.jeanf.questsystem",
3
- "version":"0.0.27",
3
+ "version":"0.0.28",
4
4
  "displayName":"Quest system",
5
5
  "description":"This package uses Scriptable Objects to define quests.",
6
6
  "unity": "2021.3",