fr.jeanf.questsystem 0.0.63 → 0.0.64
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.
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System.Collections;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace jeanf.questsystem
|
|
6
|
+
{
|
|
7
|
+
public class MultiQuestStep : QuestStep
|
|
8
|
+
{
|
|
9
|
+
[SerializeField] List<QuestStep> steps = new List<QuestStep>();
|
|
10
|
+
[SerializeField] Dictionary<string, QuestStep> stepsDictionary = new Dictionary<string, QuestStep>();
|
|
11
|
+
private void OnEnable()
|
|
12
|
+
{
|
|
13
|
+
base.OnEnable();
|
|
14
|
+
foreach(QuestStep step in steps)
|
|
15
|
+
{
|
|
16
|
+
childStep.Invoke(step);
|
|
17
|
+
sendNextStepId?.Invoke(step.StepId);
|
|
18
|
+
stepsDictionary.Add(step.StepId, step);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
stepCompleted += str => RemoveStepFromBundle(str);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
protected override void Unsubscribe()
|
|
25
|
+
{
|
|
26
|
+
base.Unsubscribe();
|
|
27
|
+
stepCompleted -= str => RemoveStepFromBundle(str);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private void RemoveStepFromBundle(string stepId)
|
|
31
|
+
{
|
|
32
|
+
if (stepsDictionary.ContainsKey(stepId))
|
|
33
|
+
{
|
|
34
|
+
stepsDictionary.Remove(stepId);
|
|
35
|
+
|
|
36
|
+
if (stepsDictionary.Count <= 0)
|
|
37
|
+
{
|
|
38
|
+
FinishQuestStep();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
}
|