summaryrefslogtreecommitdiff
path: root/GameCode/CooldownWindUp.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GameCode/CooldownWindUp.cs')
-rw-r--r--GameCode/CooldownWindUp.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/GameCode/CooldownWindUp.cs b/GameCode/CooldownWindUp.cs
new file mode 100644
index 0000000..3d443a0
--- /dev/null
+++ b/GameCode/CooldownWindUp.cs
@@ -0,0 +1,39 @@
+using UnityEngine;
+
+public class CooldownWindUp : MonoBehaviour
+{
+ public AnimationCurve multiplierCurve;
+
+ private float currentMultiplier = 1f;
+
+ private float startValue;
+
+ private float currentValue;
+
+ public float increasePerShot = 1f;
+
+ private CooldownCondition cooldown;
+
+ private void Start()
+ {
+ cooldown = GetComponent<CooldownCondition>();
+ startValue = cooldown.cooldown;
+ }
+
+ private void Update()
+ {
+ currentMultiplier = multiplierCurve.Evaluate(currentValue);
+ currentValue = Mathf.Clamp(currentValue, 0f, 100f);
+ cooldown.cooldown = startValue / currentMultiplier;
+ }
+
+ public void Reset()
+ {
+ currentValue = 0f;
+ }
+
+ public void Add()
+ {
+ currentValue += increasePerShot / currentMultiplier;
+ }
+}