summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/VerticalGauge.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assembly-CSharp/VerticalGauge.cs')
-rw-r--r--Client/Assembly-CSharp/VerticalGauge.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/VerticalGauge.cs b/Client/Assembly-CSharp/VerticalGauge.cs
new file mode 100644
index 0000000..08ebfec
--- /dev/null
+++ b/Client/Assembly-CSharp/VerticalGauge.cs
@@ -0,0 +1,28 @@
+using System;
+using UnityEngine;
+
+public class VerticalGauge : MonoBehaviour
+{
+ public float value = 0.5f;
+
+ public float MaxValue = 1f;
+
+ public float maskScale = 1f;
+
+ public SpriteMask Mask;
+
+ private float lastValue = float.MinValue;
+
+ public void Update()
+ {
+ if (this.lastValue != this.value)
+ {
+ this.lastValue = this.value;
+ float num = Mathf.Clamp(this.lastValue / this.MaxValue, 0f, 1f) * this.maskScale;
+ Vector3 localScale = this.Mask.transform.localScale;
+ localScale.y = num;
+ this.Mask.transform.localScale = localScale;
+ this.Mask.transform.localPosition = new Vector3(0f, -this.Mask.sprite.bounds.size.y * (this.maskScale - num) / 2f, 0f);
+ }
+ }
+}