diff options
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); + } + } +} |