fr.jeanf.questsystem 0.1.2 → 0.1.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.
|
@@ -60,7 +60,7 @@ namespace jeanf.questsystem
|
|
|
60
60
|
[Header("Step Parameters")]
|
|
61
61
|
[SerializeField] protected bool isTimed;
|
|
62
62
|
[SerializeField, DrawIf("isTimed", true, ComparisonType.Equals, DisablingType.DontDraw)] float timerDuration;
|
|
63
|
-
float time;
|
|
63
|
+
[SerializeField, DrawIf("isTimed", true, ComparisonType.Equals, DisablingType.ReadOnly)] float time;
|
|
64
64
|
#region standard unity methods
|
|
65
65
|
public void OnEnable()
|
|
66
66
|
{
|
|
@@ -72,7 +72,11 @@ namespace jeanf.questsystem
|
|
|
72
72
|
{
|
|
73
73
|
if (isTimed)
|
|
74
74
|
{
|
|
75
|
-
|
|
75
|
+
time += Time.deltaTime;
|
|
76
|
+
if (time > timerDuration)
|
|
77
|
+
{
|
|
78
|
+
ApplyFailureConsequence();
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
public void OnDisable() => Unsubscribe();
|
|
@@ -82,14 +86,12 @@ namespace jeanf.questsystem
|
|
|
82
86
|
private void Subscribe()
|
|
83
87
|
{
|
|
84
88
|
QuestItem.ValidateStepEvent += ValidateCurrentStep;
|
|
85
|
-
//if (abortStepSO) abortStepSO.OnEventRaised += ctx => AbortStep(ctx);
|
|
86
89
|
if(stepValidationOverride) stepValidationOverride.OnEventRaised += ValidateCurrentStep;
|
|
87
90
|
}
|
|
88
91
|
|
|
89
92
|
protected virtual void Unsubscribe()
|
|
90
93
|
{
|
|
91
94
|
QuestItem.ValidateStepEvent -= ValidateCurrentStep;
|
|
92
|
-
//if (abortStepSO) abortStepSO.OnEventRaised -= ctx => AbortStep(ctx);
|
|
93
95
|
if (stepValidationOverride) stepValidationOverride.OnEventRaised -= ValidateCurrentStep;
|
|
94
96
|
}
|
|
95
97
|
#endregion
|
|
@@ -135,22 +137,11 @@ namespace jeanf.questsystem
|
|
|
135
137
|
{
|
|
136
138
|
Destroy(this.gameObject);
|
|
137
139
|
}
|
|
138
|
-
//public void AbortStep(string id)
|
|
139
|
-
//{
|
|
140
|
-
// if (id == this.stepId)
|
|
141
|
-
// {
|
|
142
|
-
// Destroy(this.gameObject);
|
|
143
|
-
// }
|
|
144
|
-
//}
|
|
145
|
-
|
|
146
|
-
protected void increaseTimer()
|
|
147
|
-
{
|
|
148
|
-
time += Time.deltaTime;
|
|
149
140
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
141
|
+
|
|
142
|
+
protected void ApplyFailureConsequence()
|
|
143
|
+
{
|
|
144
|
+
endStepChannel.RaiseEvent(stepId);
|
|
154
145
|
}
|
|
155
146
|
public void FinishQuestStep()
|
|
156
147
|
{
|