private void Update() { if (rubikController.rotationLocked == false) { if (!pcInput) { pcInput = GetComponent <RubikPCInput>(); touchInput = GetComponent <RubikTouchInput>(); } if (Application.platform == RuntimePlatform.Android) { touchInput.enabled = true; pcInput.enabled = false; } else { touchInput.enabled = false; pcInput.enabled = true; } if (!camera) { camera = Camera.main; } if (GameManager.Instance.globalGameState.GetCurrentGameState() == GameState.InGame) { if (Screen.width < Screen.height) { minZoom = portraitMinZoom; maxZoom = portraitMaxZoom; camera.fieldOfView = Mathf.Clamp(camera.fieldOfView, minZoom, maxZoom); } else { minZoom = landScapeMinZoom; maxZoom = landScapeMaxZoom; camera.fieldOfView = Mathf.Clamp(camera.fieldOfView, minZoom, maxZoom); } camera.fieldOfView = Mathf.Lerp(camera.fieldOfView, currentFOV, 5 * Time.deltaTime); } } }
// Start is called before the first frame update void Start() { camera = Camera.main; originalCameraPos = camera.transform.position; originalCameraRot = camera.transform.rotation; originalCameraFOV = camera.fieldOfView; rubikController = GetComponent <RubikController>(); portraitMinZoom = landScapeMinZoom * portraitZoomDecreasePercentage; portraitMaxZoom = landScapeMaxZoom / portraitZoomDecreasePercentage; currentFOV = camera.fieldOfView; pcInput = GetComponent <RubikPCInput>(); touchInput = GetComponent <RubikTouchInput>(); }