fr.jeanf.questsystem 0.0.2 → 0.0.4
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/Editor/InitializeQuestSystem.cs +2 -0
- package/Runtime/Quests/Quest_StethoscopeCheck.prefab +3 -477
- package/Runtime/Quests/Quest_VisitAllPlaces.prefab +3 -477
- package/Runtime/Quests/Quest_VisitPlaces.prefab +3 -79
- package/Runtime/Scripts/Core/Quest.cs +81 -74
- package/Runtime/Scripts/Core/QuestData.cs +14 -11
- package/Runtime/Scripts/Core/QuestInfoSO.cs +15 -26
- package/Runtime/Scripts/Core/QuestItem.cs +1 -0
- package/Runtime/Scripts/Core/QuestManager.cs +196 -178
- package/Runtime/Scripts/Core/QuestState.cs +10 -7
- package/Runtime/Scripts/Core/QuestStep.cs +35 -25
- package/Runtime/Scripts/Core/QuestStepState.cs +14 -11
- package/Runtime/Scripts/Events/GameEventsManager.cs +23 -19
- package/Runtime/Scripts/Events/QuestEvents.cs +38 -30
- package/Runtime/Scripts/Input/InputManager.cs +19 -17
- package/Runtime/Scripts/Scenarios/ScenarioManager.cs +22 -19
- package/package.json +2 -1
|
@@ -1,49 +1,57 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
namespace jeanf.questsystem
|
|
4
4
|
{
|
|
5
|
-
public
|
|
6
|
-
public void StartQuest(string id)
|
|
5
|
+
public class QuestEvents
|
|
7
6
|
{
|
|
8
|
-
|
|
7
|
+
public event Action<string> onStartQuest;
|
|
8
|
+
|
|
9
|
+
public void StartQuest(string id)
|
|
9
10
|
{
|
|
10
|
-
onStartQuest
|
|
11
|
+
if (onStartQuest != null)
|
|
12
|
+
{
|
|
13
|
+
onStartQuest(id);
|
|
14
|
+
}
|
|
11
15
|
}
|
|
12
|
-
}
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (onAdvanceQuest != null)
|
|
17
|
+
public event Action<string> onAdvanceQuest;
|
|
18
|
+
|
|
19
|
+
public void AdvanceQuest(string id)
|
|
18
20
|
{
|
|
19
|
-
onAdvanceQuest
|
|
21
|
+
if (onAdvanceQuest != null)
|
|
22
|
+
{
|
|
23
|
+
onAdvanceQuest(id);
|
|
24
|
+
}
|
|
20
25
|
}
|
|
21
|
-
}
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (onFinishQuest != null)
|
|
27
|
+
public event Action<string> onFinishQuest;
|
|
28
|
+
|
|
29
|
+
public void FinishQuest(string id)
|
|
27
30
|
{
|
|
28
|
-
onFinishQuest
|
|
31
|
+
if (onFinishQuest != null)
|
|
32
|
+
{
|
|
33
|
+
onFinishQuest(id);
|
|
34
|
+
}
|
|
29
35
|
}
|
|
30
|
-
}
|
|
31
36
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (onQuestStateChange != null)
|
|
37
|
+
public event Action<Quest> onQuestStateChange;
|
|
38
|
+
|
|
39
|
+
public void QuestStateChange(Quest quest)
|
|
36
40
|
{
|
|
37
|
-
onQuestStateChange
|
|
41
|
+
if (onQuestStateChange != null)
|
|
42
|
+
{
|
|
43
|
+
onQuestStateChange(quest);
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
|
-
}
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (onQuestStepStateChange != null)
|
|
47
|
+
public event Action<string, int, QuestStepState> onQuestStepStateChange;
|
|
48
|
+
|
|
49
|
+
public void QuestStepStateChange(string id, int stepIndex, QuestStepState questStepState)
|
|
45
50
|
{
|
|
46
|
-
onQuestStepStateChange
|
|
51
|
+
if (onQuestStepStateChange != null)
|
|
52
|
+
{
|
|
53
|
+
onQuestStepStateChange(id, stepIndex, questStepState);
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
}
|
|
49
|
-
}
|
|
57
|
+
}
|
|
@@ -6,31 +6,33 @@ using UnityEngine.InputSystem;
|
|
|
6
6
|
// be sent through the GameEventManager. This lets any other
|
|
7
7
|
// script in the project easily subscribe to an input action
|
|
8
8
|
// without having to deal with the PlayerInput component directly.
|
|
9
|
-
|
|
10
|
-
[RequireComponent(typeof(PlayerInput))]
|
|
11
|
-
public class InputManager : MonoBehaviour
|
|
9
|
+
namespace jeanf.questsystem
|
|
12
10
|
{
|
|
13
|
-
|
|
11
|
+
[RequireComponent(typeof(PlayerInput))]
|
|
12
|
+
public class InputManager : MonoBehaviour
|
|
14
13
|
{
|
|
15
|
-
|
|
14
|
+
public void MovePressed(InputAction.CallbackContext context)
|
|
16
15
|
{
|
|
17
|
-
|
|
16
|
+
if (context.performed || context.canceled)
|
|
17
|
+
{
|
|
18
|
+
GameEventsManager.instance.inputEvents.MovePressed(context.ReadValue<Vector2>());
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
|
-
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
if (context.started)
|
|
22
|
+
public void SubmitPressed(InputAction.CallbackContext context)
|
|
24
23
|
{
|
|
25
|
-
|
|
24
|
+
if (context.started)
|
|
25
|
+
{
|
|
26
|
+
GameEventsManager.instance.inputEvents.SubmitPressed();
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
|
-
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
if (context.started)
|
|
30
|
+
public void QuestLogTogglePressed(InputAction.CallbackContext context)
|
|
32
31
|
{
|
|
33
|
-
|
|
32
|
+
if (context.started)
|
|
33
|
+
{
|
|
34
|
+
GameEventsManager.instance.inputEvents.QuestLogTogglePressed();
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
|
-
}
|
|
38
|
+
}
|
|
@@ -2,30 +2,33 @@ using System.Collections;
|
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using UnityEngine;
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
namespace jeanf.questsystem
|
|
6
6
|
{
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
public class ScenarioManager : MonoBehaviour
|
|
8
|
+
{
|
|
9
|
+
[Header("Configuration")] [SerializeField]
|
|
10
|
+
private List<string> unlockedScenarios = new List<string>();
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
private void OnEnable()
|
|
15
|
+
{
|
|
16
|
+
GameEventsManager.instance.scenarioEvents.onScenarioUnlocked += ScenarioUnlocked;
|
|
17
|
+
}
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
private void OnDisable()
|
|
20
|
+
{
|
|
21
|
+
GameEventsManager.instance.scenarioEvents.onScenarioUnlocked -= ScenarioUnlocked;
|
|
22
|
+
}
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
private void Start()
|
|
25
|
+
{
|
|
26
|
+
GameEventsManager.instance.scenarioEvents.ScenarioUnlocked("000_Tutorial");
|
|
27
|
+
}
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
public void ScenarioUnlocked(string id)
|
|
30
|
+
{
|
|
31
|
+
GameEventsManager.instance.scenarioEvents.ScenarioUnlocked(id);
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
|
-
}
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name":"fr.jeanf.questsystem",
|
|
3
|
-
"version":"0.0.
|
|
3
|
+
"version":"0.0.4",
|
|
4
4
|
"displayName":"Quest system",
|
|
5
5
|
"description":"This package uses Scriptable Objects to define quests.",
|
|
6
6
|
"unity": "2021.3",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"url":"https://jeanfrancoisrobin.art"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"fr.jeanf.propertydrawer": "1.1.1"
|
|
17
18
|
},
|
|
18
19
|
"samples": [
|
|
19
20
|
|