fr.jeanf.questsystem 0.0.71 → 0.1.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.
|
@@ -53,9 +53,14 @@ namespace jeanf.questsystem
|
|
|
53
53
|
[Header("Event Channels")]
|
|
54
54
|
[SerializeField] private StringEventChannelSO sendQuestStepTooltip;
|
|
55
55
|
[SerializeField] private StringEventChannelSO stepValidationOverride;
|
|
56
|
-
[SerializeField] protected StringEventChannelSO abortStepSO;
|
|
56
|
+
//[SerializeField] protected StringEventChannelSO abortStepSO;
|
|
57
|
+
[SerializeField] protected StringEventChannelSO endStepChannel;
|
|
57
58
|
#endregion
|
|
58
59
|
|
|
60
|
+
[Header("Step Parameters")]
|
|
61
|
+
[SerializeField] bool isTimed;
|
|
62
|
+
[SerializeField, DrawIf("isTimed", true, ComparisonType.Equals, DisablingType.DontDraw)] float timerDuration;
|
|
63
|
+
float time;
|
|
59
64
|
#region standard unity methods
|
|
60
65
|
public void OnEnable()
|
|
61
66
|
{
|
|
@@ -63,6 +68,13 @@ namespace jeanf.questsystem
|
|
|
63
68
|
InitializeQuestStep();
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
private void Update()
|
|
72
|
+
{
|
|
73
|
+
if (isTimed)
|
|
74
|
+
{
|
|
75
|
+
increaseTimer();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
66
78
|
public void OnDisable() => Unsubscribe();
|
|
67
79
|
|
|
68
80
|
public void OnDestroy() => Unsubscribe();
|
|
@@ -70,14 +82,14 @@ namespace jeanf.questsystem
|
|
|
70
82
|
private void Subscribe()
|
|
71
83
|
{
|
|
72
84
|
QuestItem.ValidateStepEvent += ValidateCurrentStep;
|
|
73
|
-
if (abortStepSO) abortStepSO.OnEventRaised += ctx => AbortStep(ctx);
|
|
85
|
+
//if (abortStepSO) abortStepSO.OnEventRaised += ctx => AbortStep(ctx);
|
|
74
86
|
if(stepValidationOverride) stepValidationOverride.OnEventRaised += ValidateCurrentStep;
|
|
75
87
|
}
|
|
76
88
|
|
|
77
89
|
protected virtual void Unsubscribe()
|
|
78
90
|
{
|
|
79
91
|
QuestItem.ValidateStepEvent -= ValidateCurrentStep;
|
|
80
|
-
if (abortStepSO) abortStepSO.OnEventRaised -= ctx => AbortStep(ctx);
|
|
92
|
+
//if (abortStepSO) abortStepSO.OnEventRaised -= ctx => AbortStep(ctx);
|
|
81
93
|
if (stepValidationOverride) stepValidationOverride.OnEventRaised -= ValidateCurrentStep;
|
|
82
94
|
}
|
|
83
95
|
#endregion
|
|
@@ -123,11 +135,21 @@ namespace jeanf.questsystem
|
|
|
123
135
|
{
|
|
124
136
|
Destroy(this.gameObject);
|
|
125
137
|
}
|
|
126
|
-
public void AbortStep(string id)
|
|
138
|
+
//public void AbortStep(string id)
|
|
139
|
+
//{
|
|
140
|
+
// if (id == this.stepId)
|
|
141
|
+
// {
|
|
142
|
+
// Destroy(this.gameObject);
|
|
143
|
+
// }
|
|
144
|
+
//}
|
|
145
|
+
|
|
146
|
+
protected void increaseTimer()
|
|
127
147
|
{
|
|
128
|
-
|
|
148
|
+
time += Time.deltaTime;
|
|
149
|
+
|
|
150
|
+
if (time >= timerDuration)
|
|
129
151
|
{
|
|
130
|
-
|
|
152
|
+
endStepChannel.RaiseEvent(this.stepId);
|
|
131
153
|
}
|
|
132
154
|
}
|
|
133
155
|
public void FinishQuestStep()
|