diff --git a/Assets/Scripts/Behaviours/MiniMap.cs b/Assets/Scripts/Behaviours/MiniMap.cs index 1cad30c8..9e0662b4 100644 --- a/Assets/Scripts/Behaviours/MiniMap.cs +++ b/Assets/Scripts/Behaviours/MiniMap.cs @@ -34,6 +34,8 @@ namespace SanAndreasUnity.Behaviours public Text zoneNameLabel; + private Canvas _canvas; + public float zoom = 1.3f; private const float scaleConst = 1f; @@ -49,6 +51,8 @@ namespace SanAndreasUnity.Behaviours public Vector3 FocusPos { get; set; } = Vector3.zero; + public bool IsMinimapVisible => _canvas.enabled && this.gameObject.activeInHierarchy; + public bool debugActive = true; #region "Properties" @@ -204,6 +208,8 @@ namespace SanAndreasUnity.Behaviours { Instance = this; + _canvas = this.GetComponentInParent(); + if (!isReady) return; @@ -316,8 +322,8 @@ namespace SanAndreasUnity.Behaviours private void LateUpdate() { - if (!isReady) return; - if (m_playerController != null && !GameManager.CanPlayerReadInput() && debugActive) return; + if (!this.IsMinimapVisible) + return; //Vector3 defPos = (new Vector3(pPos.x, pPos.z, 0) * (uiSize / -1000f)) / scaleConst; // Why?