extract input reading into a method

This commit is contained in:
in0finite 2020-05-01 19:03:23 +02:00
parent 9d4ca5aae6
commit dc37e76e6b

View file

@ -280,22 +280,31 @@ namespace SanAndreasUnity.Behaviours
Debug.Log("Minimap started!");
}
if (Input.GetKeyDown(KeyCode.N) && GameManager.CanPlayerReadInput())
if (GameManager.CanPlayerReadInput())
{
this.ReadInput();
}
}
private void ReadInput()
{
if (Input.GetKeyDown(KeyCode.N))
++zoomSelector;
else if (Input.GetKeyDown(KeyCode.B) && GameManager.CanPlayerReadInput())
else if (Input.GetKeyDown(KeyCode.B))
--zoomSelector;
if ((Input.GetKeyDown(KeyCode.N) || Input.GetKeyDown(KeyCode.B)) && GameManager.CanPlayerReadInput())
if (Input.GetKeyDown(KeyCode.N) || Input.GetKeyDown(KeyCode.B))
{
if (zoomCoroutine != null) StopCoroutine(zoomCoroutine);
if (zoomCoroutine != null)
StopCoroutine(zoomCoroutine);
zoomCoroutine = StartCoroutine(ChangeZoom(Input.GetKeyDown(KeyCode.N)));
}
if (Input.GetKeyDown(KeyCode.F8) && GameManager.CanPlayerReadInput())
if (Input.GetKeyDown(KeyCode.F8))
toggleInfo = !toggleInfo;
}
public static Vector2 WorldPosToMapPos(Vector3 worldPos)