fr.jeanf.questsystem 0.0.72 → 0.1.2

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.
@@ -54,11 +54,13 @@ namespace jeanf.questsystem
54
54
  [SerializeField] private StringEventChannelSO sendQuestStepTooltip;
55
55
  [SerializeField] private StringEventChannelSO stepValidationOverride;
56
56
  //[SerializeField] protected StringEventChannelSO abortStepSO;
57
+ [SerializeField] protected StringEventChannelSO endStepChannel;
57
58
  #endregion
58
59
 
59
60
  [Header("Step Parameters")]
60
- [SerializeField] bool isTimed;
61
- [SerializeField] float timerDuration;
61
+ [SerializeField] protected bool isTimed;
62
+ [SerializeField, DrawIf("isTimed", true, ComparisonType.Equals, DisablingType.DontDraw)] float timerDuration;
63
+ float time;
62
64
  #region standard unity methods
63
65
  public void OnEnable()
64
66
  {
@@ -68,7 +70,10 @@ namespace jeanf.questsystem
68
70
 
69
71
  private void Update()
70
72
  {
71
-
73
+ if (isTimed)
74
+ {
75
+ increaseTimer();
76
+ }
72
77
  }
73
78
  public void OnDisable() => Unsubscribe();
74
79
 
@@ -137,6 +142,16 @@ namespace jeanf.questsystem
137
142
  // Destroy(this.gameObject);
138
143
  // }
139
144
  //}
145
+
146
+ protected void increaseTimer()
147
+ {
148
+ time += Time.deltaTime;
149
+
150
+ if (time >= timerDuration)
151
+ {
152
+ endStepChannel.RaiseEvent(this.stepId);
153
+ }
154
+ }
140
155
  public void FinishQuestStep()
141
156
  {
142
157
  if(isDebug) Debug.Log($" ---- Step with id: {stepId} finished. Changing status to completed", this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.questsystem",
3
- "version": "0.0.72",
3
+ "version": "0.1.2",
4
4
  "displayName": "Quest system",
5
5
  "description": "This package uses Scriptable Objects to define quests.",
6
6
  "unity": "2021.3",