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.
- package/.github/workflows/publish.yml +23 -0
- package/.github/workflows.meta +8 -0
- package/README.md +20 -0
- package/README.md.meta +7 -0
- package/Runtime/Prefabs/QuestCore.prefab +359 -0
- package/Runtime/Prefabs/QuestCore.prefab.meta +7 -0
- package/Runtime/Prefabs/QuestIcon.prefab +474 -0
- package/Runtime/Prefabs/QuestIcon.prefab.meta +7 -0
- package/Runtime/Prefabs.meta +8 -0
- package/Runtime/Quests/GoToPlaces/PlaceToVisit.prefab +160 -0
- package/Runtime/Quests/GoToPlaces/PlaceToVisit.prefab.meta +7 -0
- package/Runtime/Quests/GoToPlaces/SpecificObjectCheck.prefab +158 -0
- package/Runtime/Quests/GoToPlaces/SpecificObjectCheck.prefab.meta +7 -0
- package/Runtime/Quests/GoToPlaces.meta +8 -0
- package/Runtime/Quests/Quest_StethoscopeCheck.prefab +645 -0
- package/Runtime/Quests/Quest_StethoscopeCheck.prefab.meta +7 -0
- package/Runtime/Quests/Quest_VisitAllPlaces.prefab +645 -0
- package/Runtime/Quests/Quest_VisitAllPlaces.prefab.meta +7 -0
- package/Runtime/Quests/Quest_VisitPlaces.prefab +247 -0
- package/Runtime/Quests/Quest_VisitPlaces.prefab.meta +7 -0
- package/Runtime/Quests.meta +8 -0
- package/Runtime/Scripts/Core/Quest.cs +101 -0
- package/Runtime/Scripts/Core/Quest.cs.meta +11 -0
- package/Runtime/Scripts/Core/QuestData.cs +18 -0
- package/Runtime/Scripts/Core/QuestData.cs.meta +11 -0
- package/Runtime/Scripts/Core/QuestInfoSO.cs +34 -0
- package/Runtime/Scripts/Core/QuestInfoSO.cs.meta +11 -0
- package/Runtime/Scripts/Core/QuestItem.cs +115 -0
- package/Runtime/Scripts/Core/QuestItem.cs.meta +11 -0
- package/Runtime/Scripts/Core/QuestManager.cs +243 -0
- package/Runtime/Scripts/Core/QuestManager.cs.meta +11 -0
- package/Runtime/Scripts/Core/QuestState.cs +12 -0
- package/Runtime/Scripts/Core/QuestState.cs.meta +11 -0
- package/Runtime/Scripts/Core/QuestStep.cs +38 -0
- package/Runtime/Scripts/Core/QuestStep.cs.meta +11 -0
- package/Runtime/Scripts/Core/QuestStepState.cs +19 -0
- package/Runtime/Scripts/Core/QuestStepState.cs.meta +11 -0
- package/Runtime/Scripts/Core.meta +8 -0
- package/Runtime/Scripts/Events/GameEventsManager.cs +29 -0
- package/Runtime/Scripts/Events/GameEventsManager.cs.meta +11 -0
- package/Runtime/Scripts/Events/InputEvents.cs +32 -0
- package/Runtime/Scripts/Events/InputEvents.cs.meta +11 -0
- package/Runtime/Scripts/Events/MiscEvents.cs +22 -0
- package/Runtime/Scripts/Events/MiscEvents.cs.meta +11 -0
- package/Runtime/Scripts/Events/PlayerEvents.cs +49 -0
- package/Runtime/Scripts/Events/PlayerEvents.cs.meta +11 -0
- package/Runtime/Scripts/Events/QuestEvents.cs +49 -0
- package/Runtime/Scripts/Events/QuestEvents.cs.meta +11 -0
- package/Runtime/Scripts/Events/ScenarioEvents.cs +22 -0
- package/Runtime/Scripts/Events/ScenarioEvents.cs.meta +11 -0
- package/Runtime/Scripts/Events.meta +8 -0
- package/Runtime/Scripts/Input/InputManager.cs +36 -0
- package/Runtime/Scripts/Input/InputManager.cs.meta +11 -0
- package/Runtime/Scripts/Input.meta +8 -0
- package/Runtime/Scripts/Prefabs/QuestCore.prefab +126 -0
- package/Runtime/Scripts/Prefabs/QuestCore.prefab.meta +7 -0
- package/Runtime/Scripts/Prefabs/QuestStatusListner_DEBUG.prefab +235 -0
- package/Runtime/Scripts/Prefabs/QuestStatusListner_DEBUG.prefab.meta +7 -0
- package/Runtime/Scripts/Prefabs.meta +8 -0
- package/Runtime/Scripts/Scenarios/ScenarioManager.cs +31 -0
- package/Runtime/Scripts/Scenarios/ScenarioManager.cs.meta +11 -0
- package/Runtime/Scripts/Scenarios.meta +8 -0
- package/Runtime/Scripts/jeanf.QuestSystem.asmdef +18 -0
- package/Runtime/Scripts/jeanf.QuestSystem.asmdef.meta +7 -0
- package/Runtime/Scripts/quests/GoToPlaces/PlaceToVisit.prefab +142 -0
- package/Runtime/Scripts/quests/GoToPlaces/PlaceToVisit.prefab.meta +7 -0
- package/Runtime/Scripts/quests/GoToPlaces/SpecificObjectCheck.prefab +158 -0
- package/Runtime/Scripts/quests/GoToPlaces/SpecificObjectCheck.prefab.meta +7 -0
- package/Runtime/Scripts/quests/GoToPlaces.meta +8 -0
- package/Runtime/Scripts/quests/Quest_StethoscopeCheck.prefab +645 -0
- package/Runtime/Scripts/quests/Quest_StethoscopeCheck.prefab.meta +7 -0
- package/Runtime/Scripts/quests/Quest_VisitAllPlaces.prefab +645 -0
- package/Runtime/Scripts/quests/Quest_VisitAllPlaces.prefab.meta +7 -0
- package/Runtime/Scripts/quests/Quest_VisitPlaces.prefab +272 -0
- package/Runtime/Scripts/quests/Quest_VisitPlaces.prefab.meta +7 -0
- package/Runtime/Scripts/quests.meta +8 -0
- package/Runtime/Scripts.meta +8 -0
- package/Runtime.meta +8 -0
- package/package.json +21 -0
- 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,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,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,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,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,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,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,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,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
|
+
}
|