don't update stuff when minimap is not visible

This commit is contained in:
in0finite 2020-05-01 18:58:48 +02:00
parent 0668cf62f1
commit 9d4ca5aae6

View file

@ -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<Canvas>();
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?