void Update() { //Debug.Log(targetPPU); if ((Input.GetMouseButton(0) || Input.touchCount >= 1)) { //Zoom In slower when close to the final value zoomInFactor = zoomInFactor / 2 + zoomFactor * (1f - ((float)this.gameObject.GetComponent <PixelPerfectCamera>().assetsPPU / (float)256)); targetPPU += zoomInFactor * Time.deltaTime; OnZoomChange?.Invoke(this, new OnZoomChangeEventArgs { In = true });; } else { //Zoom out always with the same factor targetPPU -= zoomFactor * Time.deltaTime; cameraFollow.Setup(() => Vector3.zero); OnZoomChange?.Invoke(this, new OnZoomChangeEventArgs { In = false });; } targetPPU = Mathf.Clamp(targetPPU, 128, 256); this.gameObject.GetComponent <PixelPerfectCamera>().assetsPPU = (int)targetPPU; }
internal void FireZoomChanged() { OnZoomChange?.Invoke(this, ZoomMin, ZoomMax); }
void InvokeCameraZoom() { OnZoomChange?.Invoke(cameraClose); }