summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/VerticalGauge.cs
blob: 08ebfecdce79c55cc9c97b8da53e70a0f063b047 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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);
		}
	}
}