diff options
| author | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
|---|---|---|
| committer | chai <chaifix@163.com> | 2020-12-30 20:59:04 +0800 |
| commit | e9ea621b93fbb58d9edfca8375918791637bbd52 (patch) | |
| tree | 19ce3b1c1f2d51eda6878c9d0f2c9edc27f13650 /Client/Assembly-CSharp/HorizontalGauge.cs | |
+init
Diffstat (limited to 'Client/Assembly-CSharp/HorizontalGauge.cs')
| -rw-r--r-- | Client/Assembly-CSharp/HorizontalGauge.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/HorizontalGauge.cs b/Client/Assembly-CSharp/HorizontalGauge.cs new file mode 100644 index 0000000..2995903 --- /dev/null +++ b/Client/Assembly-CSharp/HorizontalGauge.cs @@ -0,0 +1,26 @@ +using System; +using UnityEngine; + +public class HorizontalGauge : 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.MaxValue != 0f && this.lastValue != this.Value) + { + this.lastValue = this.Value; + float num = this.lastValue / this.MaxValue * this.maskScale; + this.Mask.transform.localScale = new Vector3(num, 1f, 1f); + this.Mask.transform.localPosition = new Vector3(-this.Mask.sprite.bounds.size.x * (this.maskScale - num) / 2f, 0f, 0f); + } + } +} |
