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.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.Instance.SetHudActive(false); } public void ShowCountOverlay() { this.GenericShow(); this.countOverlay.gameObject.SetActive(true); this.taskOverlay.Hide(); this.HerePoint.enabled = false; DestroyableSingleton.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.Instance.SetHudActive(true); } }