fr.jeanf.questsystem 0.0.1

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.
Files changed (80) hide show
  1. package/.github/workflows/publish.yml +23 -0
  2. package/.github/workflows.meta +8 -0
  3. package/README.md +20 -0
  4. package/README.md.meta +7 -0
  5. package/Runtime/Prefabs/QuestCore.prefab +359 -0
  6. package/Runtime/Prefabs/QuestCore.prefab.meta +7 -0
  7. package/Runtime/Prefabs/QuestIcon.prefab +474 -0
  8. package/Runtime/Prefabs/QuestIcon.prefab.meta +7 -0
  9. package/Runtime/Prefabs.meta +8 -0
  10. package/Runtime/Quests/GoToPlaces/PlaceToVisit.prefab +160 -0
  11. package/Runtime/Quests/GoToPlaces/PlaceToVisit.prefab.meta +7 -0
  12. package/Runtime/Quests/GoToPlaces/SpecificObjectCheck.prefab +158 -0
  13. package/Runtime/Quests/GoToPlaces/SpecificObjectCheck.prefab.meta +7 -0
  14. package/Runtime/Quests/GoToPlaces.meta +8 -0
  15. package/Runtime/Quests/Quest_StethoscopeCheck.prefab +645 -0
  16. package/Runtime/Quests/Quest_StethoscopeCheck.prefab.meta +7 -0
  17. package/Runtime/Quests/Quest_VisitAllPlaces.prefab +645 -0
  18. package/Runtime/Quests/Quest_VisitAllPlaces.prefab.meta +7 -0
  19. package/Runtime/Quests/Quest_VisitPlaces.prefab +247 -0
  20. package/Runtime/Quests/Quest_VisitPlaces.prefab.meta +7 -0
  21. package/Runtime/Quests.meta +8 -0
  22. package/Runtime/Scripts/Core/Quest.cs +101 -0
  23. package/Runtime/Scripts/Core/Quest.cs.meta +11 -0
  24. package/Runtime/Scripts/Core/QuestData.cs +18 -0
  25. package/Runtime/Scripts/Core/QuestData.cs.meta +11 -0
  26. package/Runtime/Scripts/Core/QuestInfoSO.cs +34 -0
  27. package/Runtime/Scripts/Core/QuestInfoSO.cs.meta +11 -0
  28. package/Runtime/Scripts/Core/QuestItem.cs +115 -0
  29. package/Runtime/Scripts/Core/QuestItem.cs.meta +11 -0
  30. package/Runtime/Scripts/Core/QuestManager.cs +243 -0
  31. package/Runtime/Scripts/Core/QuestManager.cs.meta +11 -0
  32. package/Runtime/Scripts/Core/QuestState.cs +12 -0
  33. package/Runtime/Scripts/Core/QuestState.cs.meta +11 -0
  34. package/Runtime/Scripts/Core/QuestStep.cs +38 -0
  35. package/Runtime/Scripts/Core/QuestStep.cs.meta +11 -0
  36. package/Runtime/Scripts/Core/QuestStepState.cs +19 -0
  37. package/Runtime/Scripts/Core/QuestStepState.cs.meta +11 -0
  38. package/Runtime/Scripts/Core.meta +8 -0
  39. package/Runtime/Scripts/Events/GameEventsManager.cs +29 -0
  40. package/Runtime/Scripts/Events/GameEventsManager.cs.meta +11 -0
  41. package/Runtime/Scripts/Events/InputEvents.cs +32 -0
  42. package/Runtime/Scripts/Events/InputEvents.cs.meta +11 -0
  43. package/Runtime/Scripts/Events/MiscEvents.cs +22 -0
  44. package/Runtime/Scripts/Events/MiscEvents.cs.meta +11 -0
  45. package/Runtime/Scripts/Events/PlayerEvents.cs +49 -0
  46. package/Runtime/Scripts/Events/PlayerEvents.cs.meta +11 -0
  47. package/Runtime/Scripts/Events/QuestEvents.cs +49 -0
  48. package/Runtime/Scripts/Events/QuestEvents.cs.meta +11 -0
  49. package/Runtime/Scripts/Events/ScenarioEvents.cs +22 -0
  50. package/Runtime/Scripts/Events/ScenarioEvents.cs.meta +11 -0
  51. package/Runtime/Scripts/Events.meta +8 -0
  52. package/Runtime/Scripts/Input/InputManager.cs +36 -0
  53. package/Runtime/Scripts/Input/InputManager.cs.meta +11 -0
  54. package/Runtime/Scripts/Input.meta +8 -0
  55. package/Runtime/Scripts/Prefabs/QuestCore.prefab +126 -0
  56. package/Runtime/Scripts/Prefabs/QuestCore.prefab.meta +7 -0
  57. package/Runtime/Scripts/Prefabs/QuestStatusListner_DEBUG.prefab +235 -0
  58. package/Runtime/Scripts/Prefabs/QuestStatusListner_DEBUG.prefab.meta +7 -0
  59. package/Runtime/Scripts/Prefabs.meta +8 -0
  60. package/Runtime/Scripts/Scenarios/ScenarioManager.cs +31 -0
  61. package/Runtime/Scripts/Scenarios/ScenarioManager.cs.meta +11 -0
  62. package/Runtime/Scripts/Scenarios.meta +8 -0
  63. package/Runtime/Scripts/jeanf.QuestSystem.asmdef +18 -0
  64. package/Runtime/Scripts/jeanf.QuestSystem.asmdef.meta +7 -0
  65. package/Runtime/Scripts/quests/GoToPlaces/PlaceToVisit.prefab +142 -0
  66. package/Runtime/Scripts/quests/GoToPlaces/PlaceToVisit.prefab.meta +7 -0
  67. package/Runtime/Scripts/quests/GoToPlaces/SpecificObjectCheck.prefab +158 -0
  68. package/Runtime/Scripts/quests/GoToPlaces/SpecificObjectCheck.prefab.meta +7 -0
  69. package/Runtime/Scripts/quests/GoToPlaces.meta +8 -0
  70. package/Runtime/Scripts/quests/Quest_StethoscopeCheck.prefab +645 -0
  71. package/Runtime/Scripts/quests/Quest_StethoscopeCheck.prefab.meta +7 -0
  72. package/Runtime/Scripts/quests/Quest_VisitAllPlaces.prefab +645 -0
  73. package/Runtime/Scripts/quests/Quest_VisitAllPlaces.prefab.meta +7 -0
  74. package/Runtime/Scripts/quests/Quest_VisitPlaces.prefab +272 -0
  75. package/Runtime/Scripts/quests/Quest_VisitPlaces.prefab.meta +7 -0
  76. package/Runtime/Scripts/quests.meta +8 -0
  77. package/Runtime/Scripts.meta +8 -0
  78. package/Runtime.meta +8 -0
  79. package/package.json +21 -0
  80. package/package.json.meta +7 -0
@@ -0,0 +1,243 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using jeanf.EventSystem;
4
+ using UnityEngine;
5
+ using UnityEngine.Serialization;
6
+
7
+ public class QuestManager : MonoBehaviour, IDebugBehaviour
8
+ {
9
+ public bool isDebug
10
+ {
11
+ get => _isDebug;
12
+ set => _isDebug = value;
13
+ }
14
+ [SerializeField] private bool _isDebug = false;
15
+ [FormerlySerializedAs("loadQuestState")]
16
+ [Header("Config")]
17
+ [SerializeField] private bool loadSavedQuestState = true;
18
+ [Header("Broadcasting on:")] [SerializeField] private StringEventChannelSO questStatusUpdateChannel;
19
+ [Header("Broadcasting on:")] [SerializeField] private StringFloatEventChannelSO questProgress;
20
+
21
+ private Dictionary<string, Quest> questMap;
22
+
23
+ // quest start requirements
24
+ private int currentPlayerLevel;
25
+
26
+ private void Awake()
27
+ {
28
+ questMap = CreateQuestMap();
29
+ }
30
+
31
+ private void OnEnable()
32
+ {
33
+ GameEventsManager.instance.questEvents.onStartQuest += StartQuest;
34
+ GameEventsManager.instance.questEvents.onAdvanceQuest += AdvanceQuest;
35
+ GameEventsManager.instance.questEvents.onFinishQuest += FinishQuest;
36
+
37
+ GameEventsManager.instance.questEvents.onQuestStepStateChange += QuestStepStateChange;
38
+
39
+ GameEventsManager.instance.playerEvents.onPlayerLevelChange += PlayerLevelChange;
40
+ }
41
+
42
+ private void OnDisable()
43
+ {
44
+ GameEventsManager.instance.questEvents.onStartQuest -= StartQuest;
45
+ GameEventsManager.instance.questEvents.onAdvanceQuest -= AdvanceQuest;
46
+ GameEventsManager.instance.questEvents.onFinishQuest -= FinishQuest;
47
+
48
+ GameEventsManager.instance.questEvents.onQuestStepStateChange -= QuestStepStateChange;
49
+
50
+ GameEventsManager.instance.playerEvents.onPlayerLevelChange -= PlayerLevelChange;
51
+ }
52
+
53
+ private void Start()
54
+ {
55
+
56
+ foreach (Quest quest in questMap.Values)
57
+ {
58
+ // initialize any loaded quest steps
59
+ if (quest.state == QuestState.IN_PROGRESS)
60
+ {
61
+ quest.InstantiateCurrentQuestStep(this.transform);
62
+ }
63
+ // broadcast the initial state of all quests on startup
64
+ GameEventsManager.instance.questEvents.QuestStateChange(quest);
65
+ }
66
+ }
67
+
68
+ private void ChangeQuestState(string id, QuestState state)
69
+ {
70
+ Quest quest = GetQuestById(id);
71
+ quest.state = state;
72
+ GameEventsManager.instance.questEvents.QuestStateChange(quest);
73
+ }
74
+
75
+ private void PlayerLevelChange(int level)
76
+ {
77
+ currentPlayerLevel = level;
78
+ }
79
+
80
+ private bool CheckRequirementsMet(Quest quest)
81
+ {
82
+ // check player level requirements
83
+ var meetsRequirements = !(currentPlayerLevel < quest.info.levelRequirement);
84
+
85
+ // check quest prerequisites for completion
86
+ foreach (QuestInfoSO prerequisiteQuestInfo in quest.info.questPrerequisites)
87
+ {
88
+ if (GetQuestById(prerequisiteQuestInfo.id).state != QuestState.FINISHED)
89
+ {
90
+ meetsRequirements = false;
91
+ }
92
+ }
93
+
94
+ return meetsRequirements;
95
+ }
96
+
97
+ private void Update()
98
+ {
99
+ // loop through ALL quests
100
+ foreach (Quest quest in questMap.Values)
101
+ {
102
+ // if we're now meeting the requirements, switch over to the CAN_START state
103
+ if (quest.state == QuestState.REQUIREMENTS_NOT_MET && CheckRequirementsMet(quest))
104
+ {
105
+ ChangeQuestState(quest.info.id, QuestState.CAN_START);
106
+ }
107
+ }
108
+ }
109
+
110
+ private void StartQuest(string id)
111
+ {
112
+ Quest quest = GetQuestById(id);
113
+ quest.InstantiateCurrentQuestStep(this.transform);
114
+ ChangeQuestState(quest.info.id, QuestState.IN_PROGRESS);
115
+ SaveQuest(quest);
116
+ }
117
+
118
+ private void AdvanceQuest(string id)
119
+ {
120
+ Quest quest = GetQuestById(id);
121
+
122
+ // move on to the next step
123
+ quest.MoveToNextStep();
124
+ if(isDebug) Debug.Log($"[{quest.info.id}]quest state: {quest.state} - {quest.currentStep} over {quest.info.questStepPrefabs.Length} steps done", this);
125
+ questStatusUpdateChannel.RaiseEvent($"[{quest.info.id}]quest state: {quest.state} - {quest.currentStep} over {quest.info.questStepPrefabs.Length} steps done");
126
+ var progress = (float) quest.currentStep / quest.info.questStepPrefabs.Length;
127
+ if(isDebug) Debug.Log($"[{quest.info.id}] progress: {progress*100}%", this);
128
+ questProgress.RaiseEvent(quest.info.id, progress);
129
+
130
+ // if there are more steps, instantiate the next one
131
+ if (quest.CurrentStepExists())
132
+ {
133
+ quest.InstantiateCurrentQuestStep(this.transform);
134
+ }
135
+ // if there are no more steps, then we've finished all of them for this quest
136
+ else
137
+ {
138
+ ChangeQuestState(quest.info.id, QuestState.CAN_FINISH);
139
+ }
140
+ SaveQuest(quest);
141
+ }
142
+
143
+ private void FinishQuest(string id)
144
+ {
145
+ Quest quest = GetQuestById(id);
146
+ ClaimRewards(quest);
147
+ ChangeQuestState(quest.info.id, QuestState.FINISHED);
148
+ questStatusUpdateChannel.RaiseEvent($"[{quest.info.id}] quest is finished.");
149
+ questProgress.RaiseEvent(quest.info.id,1);
150
+ SaveQuest(quest);
151
+ }
152
+
153
+ private void ClaimRewards(Quest quest)
154
+ {
155
+ GameEventsManager.instance.scenarioEvents.ScenarioUnlocked(quest.info.unlockedScenario);
156
+ }
157
+
158
+ private void QuestStepStateChange(string id, int stepIndex, QuestStepState questStepState)
159
+ {
160
+ Quest quest = GetQuestById(id);
161
+ quest.StoreQuestStepState(questStepState, stepIndex);
162
+ ChangeQuestState(id, quest.state);
163
+ }
164
+
165
+ private Dictionary<string, Quest> CreateQuestMap()
166
+ {
167
+ // loads all QuestInfoSO Scriptable Objects under the Assets/Resources/Quests folder
168
+ QuestInfoSO[] allQuests = Resources.LoadAll<QuestInfoSO>("Quests");
169
+ // Create the quest map
170
+ Dictionary<string, Quest> idToQuestMap = new Dictionary<string, Quest>();
171
+ foreach (QuestInfoSO questInfo in allQuests)
172
+ {
173
+ if (idToQuestMap.ContainsKey(questInfo.id))
174
+ {
175
+ Debug.LogWarning("Duplicate ID found when creating quest map: " + questInfo.id);
176
+ }
177
+ idToQuestMap.Add(questInfo.id, LoadQuest(questInfo));
178
+ }
179
+ return idToQuestMap;
180
+ }
181
+
182
+ private Quest GetQuestById(string id)
183
+ {
184
+ Quest quest = questMap[id];
185
+ if (quest == null)
186
+ {
187
+ Debug.LogError("ID not found in the Quest Map: " + id);
188
+ }
189
+ return quest;
190
+ }
191
+
192
+ private void OnApplicationQuit()
193
+ {
194
+ foreach (Quest quest in questMap.Values)
195
+ {
196
+ SaveQuest(quest);
197
+ }
198
+ }
199
+
200
+ private void SaveQuest(Quest quest)
201
+ {
202
+ try
203
+ {
204
+ QuestData questData = quest.GetQuestData();
205
+ // serialize using JsonUtility, but use whatever you want here (like JSON.NET)
206
+ string serializedData = JsonUtility.ToJson(questData);
207
+ Debug.Log($"saved data {serializedData}");
208
+ // saving to PlayerPrefs is just a quick example for this tutorial video,
209
+ // you probably don't want to save this info there long-term.
210
+ // instead, use an actual Save & Load system and write to a file, the cloud, etc..
211
+ PlayerPrefs.SetString(quest.info.id, serializedData);
212
+ }
213
+ catch (System.Exception e)
214
+ {
215
+ Debug.LogError("Failed to save quest with id " + quest.info.id + ": " + e);
216
+ }
217
+ }
218
+
219
+ private Quest LoadQuest(QuestInfoSO questInfo)
220
+ {
221
+ Quest quest = null;
222
+ try
223
+ {
224
+ // load quest from saved data
225
+ if (PlayerPrefs.HasKey(questInfo.id) && loadSavedQuestState)
226
+ {
227
+ string serializedData = PlayerPrefs.GetString(questInfo.id);
228
+ QuestData questData = JsonUtility.FromJson<QuestData>(serializedData);
229
+ quest = new Quest(questInfo, questData.state, questData.questStepIndex, questData.questStepStates);
230
+ }
231
+ // otherwise, initialize a new quest
232
+ else
233
+ {
234
+ quest = new Quest(questInfo);
235
+ }
236
+ }
237
+ catch (System.Exception e)
238
+ {
239
+ Debug.LogError("Failed to load quest with id " + quest.info.id + ": " + e);
240
+ }
241
+ return quest;
242
+ }
243
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d02fa90f793fbd04e876c5a02753bcbc
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,12 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+
5
+ public enum QuestState
6
+ {
7
+ REQUIREMENTS_NOT_MET,
8
+ CAN_START,
9
+ IN_PROGRESS,
10
+ CAN_FINISH,
11
+ FINISHED
12
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: eff93968abb607d45b86e8b019282186
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,38 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+
5
+ public abstract class QuestStep : MonoBehaviour
6
+ {
7
+ private bool isFinished = false;
8
+ private string questId;
9
+ private int stepIndex;
10
+ private float questStepProgress = 0;
11
+
12
+ public void InitializeQuestStep(string questId, int stepIndex, string questStepState)
13
+ {
14
+ this.questId = questId;
15
+ this.stepIndex = stepIndex;
16
+ if (questStepState != null && questStepState != "")
17
+ {
18
+ SetQuestStepState(questStepState);
19
+ }
20
+ }
21
+
22
+ protected void FinishQuestStep()
23
+ {
24
+ if (!isFinished)
25
+ {
26
+ isFinished = true;
27
+ GameEventsManager.instance.questEvents.AdvanceQuest(questId);
28
+ Destroy(this.gameObject);
29
+ }
30
+ }
31
+
32
+ protected void ChangeState(string newState)
33
+ {
34
+ GameEventsManager.instance.questEvents.QuestStepStateChange(questId, stepIndex, new QuestStepState(newState));
35
+ }
36
+
37
+ protected abstract void SetQuestStepState(string state);
38
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 5c5332ca0301f0b4c96bd5d094e46e53
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,19 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+
5
+ [System.Serializable]
6
+ public class QuestStepState
7
+ {
8
+ public string state;
9
+
10
+ public QuestStepState(string state)
11
+ {
12
+ this.state = state;
13
+ }
14
+
15
+ public QuestStepState()
16
+ {
17
+ this.state = "";
18
+ }
19
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 361ad11d06b448c428c62cbfdd5c22ef
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: d2e587236ade3a84ea55f8612c7fe71e
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,29 @@
1
+ using System;
2
+ using UnityEngine;
3
+
4
+ public class GameEventsManager : MonoBehaviour
5
+ {
6
+ public static GameEventsManager instance { get; private set; }
7
+
8
+ public InputEvents inputEvents;
9
+ public PlayerEvents playerEvents;
10
+ public ScenarioEvents scenarioEvents;
11
+ public MiscEvents miscEvents;
12
+ public QuestEvents questEvents;
13
+
14
+ private void Awake()
15
+ {
16
+ if (instance != null)
17
+ {
18
+ Debug.LogError("Found more than one Game Events Manager in the scene.");
19
+ }
20
+ instance = this;
21
+
22
+ // initialize all events
23
+ inputEvents = new InputEvents();
24
+ playerEvents = new PlayerEvents();
25
+ scenarioEvents = new ScenarioEvents();
26
+ miscEvents = new MiscEvents();
27
+ questEvents = new QuestEvents();
28
+ }
29
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e911054512a703f4ab899299cfcf229e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: -20
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,32 @@
1
+ using UnityEngine;
2
+ using System;
3
+
4
+ public class InputEvents
5
+ {
6
+ public event Action<Vector2> onMovePressed;
7
+ public void MovePressed(Vector2 moveDir)
8
+ {
9
+ if (onMovePressed != null)
10
+ {
11
+ onMovePressed(moveDir);
12
+ }
13
+ }
14
+
15
+ public event Action onSubmitPressed;
16
+ public void SubmitPressed()
17
+ {
18
+ if (onSubmitPressed != null)
19
+ {
20
+ onSubmitPressed();
21
+ }
22
+ }
23
+
24
+ public event Action onQuestLogTogglePressed;
25
+ public void QuestLogTogglePressed()
26
+ {
27
+ if (onQuestLogTogglePressed != null)
28
+ {
29
+ onQuestLogTogglePressed();
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 489b7fbcb77df0e498b7eb2756342a5d
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,22 @@
1
+ using System;
2
+
3
+ public class MiscEvents
4
+ {
5
+ public event Action onCoinCollected;
6
+ public void CoinCollected()
7
+ {
8
+ if (onCoinCollected != null)
9
+ {
10
+ onCoinCollected();
11
+ }
12
+ }
13
+
14
+ public event Action onGemCollected;
15
+ public void GemCollected()
16
+ {
17
+ if (onGemCollected != null)
18
+ {
19
+ onGemCollected();
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 47894cdb62664e446b78ef93cb8ee8f0
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,49 @@
1
+ using System;
2
+
3
+ public class PlayerEvents
4
+ {
5
+ public event Action onDisablePlayerMovement;
6
+ public void DisablePlayerMovement()
7
+ {
8
+ if (onDisablePlayerMovement != null)
9
+ {
10
+ onDisablePlayerMovement();
11
+ }
12
+ }
13
+
14
+ public event Action onEnablePlayerMovement;
15
+ public void EnablePlayerMovement()
16
+ {
17
+ if (onEnablePlayerMovement != null)
18
+ {
19
+ onEnablePlayerMovement();
20
+ }
21
+ }
22
+
23
+ public event Action<int> onExperienceGained;
24
+ public void ExperienceGained(int experience)
25
+ {
26
+ if (onExperienceGained != null)
27
+ {
28
+ onExperienceGained(experience);
29
+ }
30
+ }
31
+
32
+ public event Action<int> onPlayerLevelChange;
33
+ public void PlayerLevelChange(int level)
34
+ {
35
+ if (onPlayerLevelChange != null)
36
+ {
37
+ onPlayerLevelChange(level);
38
+ }
39
+ }
40
+
41
+ public event Action<int> onPlayerExperienceChange;
42
+ public void PlayerExperienceChange(int experience)
43
+ {
44
+ if (onPlayerExperienceChange != null)
45
+ {
46
+ onPlayerExperienceChange(experience);
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 05c42289208d5b94da07adea1a6c16fb
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,49 @@
1
+ using System;
2
+
3
+ public class QuestEvents
4
+ {
5
+ public event Action<string> onStartQuest;
6
+ public void StartQuest(string id)
7
+ {
8
+ if (onStartQuest != null)
9
+ {
10
+ onStartQuest(id);
11
+ }
12
+ }
13
+
14
+ public event Action<string> onAdvanceQuest;
15
+ public void AdvanceQuest(string id)
16
+ {
17
+ if (onAdvanceQuest != null)
18
+ {
19
+ onAdvanceQuest(id);
20
+ }
21
+ }
22
+
23
+ public event Action<string> onFinishQuest;
24
+ public void FinishQuest(string id)
25
+ {
26
+ if (onFinishQuest != null)
27
+ {
28
+ onFinishQuest(id);
29
+ }
30
+ }
31
+
32
+ public event Action<Quest> onQuestStateChange;
33
+ public void QuestStateChange(Quest quest)
34
+ {
35
+ if (onQuestStateChange != null)
36
+ {
37
+ onQuestStateChange(quest);
38
+ }
39
+ }
40
+
41
+ public event Action<string, int, QuestStepState> onQuestStepStateChange;
42
+ public void QuestStepStateChange(string id, int stepIndex, QuestStepState questStepState)
43
+ {
44
+ if (onQuestStepStateChange != null)
45
+ {
46
+ onQuestStepStateChange(id, stepIndex, questStepState);
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 42cf4d17c2e0d77469d63e6c4f6e95e6
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,22 @@
1
+ using System;
2
+
3
+ public class ScenarioEvents
4
+ {
5
+ public event Action<string> onScenarioUnlocked;
6
+ public void ScenarioUnlocked(string id)
7
+ {
8
+ if (onScenarioUnlocked != null)
9
+ {
10
+ onScenarioUnlocked(id);
11
+ }
12
+ }
13
+
14
+ public event Action<string> onScenarioLocked;
15
+ public void ScenarioLocked(string id)
16
+ {
17
+ if (onScenarioLocked != null)
18
+ {
19
+ onScenarioLocked(id);
20
+ }
21
+ }
22
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 40aa22e174b64d44b8d90da11226d341
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: c0cfd8bf31682f44b8a448b54fd8c779
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant: