summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/MapBehaviour.cs
blob: 85d6b39fedfface083d3397df29c554973837e58 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System;
using UnityEngine;

public class MapBehaviour : MonoBehaviour
{
	public bool IsOpen
	{
		get
		{
			return base.isActiveAndEnabled;
		}
	}

	public bool IsOpenStopped
	{
		get
		{
			return this.IsOpen && this.countOverlay.isActiveAndEnabled;
		}
	}

	public static MapBehaviour Instance;

	public AlphaPulse ColorControl;

	public SpriteRenderer HerePoint;

	public MapCountOverlay countOverlay;

	public InfectedOverlay infectedOverlay;

	public MapTaskOverlay taskOverlay;

	private void Awake()
	{
		MapBehaviour.Instance = this;
	}

	private void GenericShow()
	{
		base.transform.localScale = Vector3.one;
		base.transform.localPosition = new Vector3(0f, 0f, -25f);
		base.gameObject.SetActive(true);
	}

	public void ShowInfectedMap()
	{
		if (this.IsOpen)
		{
			this.Close();
			return;
		}
		if (!PlayerControl.LocalPlayer.CanMove)
		{
			return;
		}
		PlayerControl.LocalPlayer.SetPlayerMaterialColors(this.HerePoint);
		this.GenericShow();
		this.infectedOverlay.gameObject.SetActive(true);
		this.ColorControl.SetColor(Palette.ImpostorRed);
		this.taskOverlay.Hide();
		DestroyableSingleton<HudManager>.Instance.SetHudActive(false);
	}

	public void ShowNormalMap()
	{
		if (this.IsOpen)
		{
			this.Close();
			return;
		}
		if (!PlayerControl.LocalPlayer.CanMove)
		{
			return;
		}
		PlayerControl.LocalPlayer.SetPlayerMaterialColors(this.HerePoint);
		this.GenericShow();
		this.taskOverlay.Show();
		this.ColorControl.SetColor(new Color(0.05f, 0.2f, 1f, 1f));
		DestroyableSingleton<HudManager>.Instance.SetHudActive(false);
	}

	public void ShowCountOverlay()
	{
		this.GenericShow();
		this.countOverlay.gameObject.SetActive(true);
		this.taskOverlay.Hide();
		this.HerePoint.enabled = false;
		DestroyableSingleton<HudManager>.Instance.SetHudActive(false);
	}

	public void FixedUpdate()
	{
		if (!ShipStatus.Instance)
		{
			return;
		}
		Vector3 vector = PlayerControl.LocalPlayer.transform.position;
		vector /= ShipStatus.Instance.MapScale;
		vector.z = -1f;
		this.HerePoint.transform.localPosition = vector;
	}

	public void Close()
	{
		base.gameObject.SetActive(false);
		this.countOverlay.gameObject.SetActive(false);
		this.infectedOverlay.gameObject.SetActive(false);
		this.taskOverlay.Hide();
		this.HerePoint.enabled = true;
		DestroyableSingleton<HudManager>.Instance.SetHudActive(true);
	}
}