summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/ProgressTracker.cs
blob: 60cae928551943aea657ae28d4d7e42c5852d11d (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
29
30
31
32
33
34
35
36
37
38
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);
		}
	}
}