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/ProgressTracker.cs | |
+init
Diffstat (limited to 'Client/Assembly-CSharp/ProgressTracker.cs')
| -rw-r--r-- | Client/Assembly-CSharp/ProgressTracker.cs | 39 | 
1 files changed, 39 insertions, 0 deletions
| diff --git a/Client/Assembly-CSharp/ProgressTracker.cs b/Client/Assembly-CSharp/ProgressTracker.cs new file mode 100644 index 0000000..60cae92 --- /dev/null +++ b/Client/Assembly-CSharp/ProgressTracker.cs @@ -0,0 +1,39 @@ +using System; +using System.Linq; +using UnityEngine; + +public class ProgressTracker : MonoBehaviour +{ +	public MeshRenderer TileParent; + +	private float curValue; + +	public void Start() +	{ +		this.TileParent.material.SetFloat("_Buckets", 1f); +		this.TileParent.material.SetFloat("_FullBuckets", 0f); +	} + +	public void FixedUpdate() +	{ +		if (PlayerTask.PlayerHasHudTask(PlayerControl.LocalPlayer)) +		{ +			this.TileParent.enabled = false; +			return; +		} +		if (!this.TileParent.enabled) +		{ +			this.TileParent.enabled = true; +		} +		GameData instance = GameData.Instance; +		if (instance && instance.TotalTasks > 0) +		{ +			int num = DestroyableSingleton<TutorialManager>.InstanceExists ? 1 : (instance.AllPlayers.Count - PlayerControl.GameOptions.NumImpostors); +			num -= instance.AllPlayers.Count((GameData.PlayerInfo p) => p.Disconnected); +			float b = (float)instance.CompletedTasks / (float)instance.TotalTasks * (float)num; +			this.curValue = Mathf.Lerp(this.curValue, b, Time.fixedDeltaTime * 2f); +			this.TileParent.material.SetFloat("_Buckets", (float)num); +			this.TileParent.material.SetFloat("_FullBuckets", this.curValue); +		} +	} +} | 
