Beispiel #1
0
        public IEnumerator ZoomOverTime(float damping, float targetZoom)
        {
            var currentZoom         = _camera.orthographicSize;
            var currentZoomVelocity = 0.0f;

            while (true)
            {
                if (FloatUtils.IsApproximately(currentZoom, targetZoom, _zoomThreshold))
                {
                    _camera.orthographicSize = targetZoom;
                    yield break;
                }

                currentZoom = Mathf.SmoothDamp(currentZoom, targetZoom, ref currentZoomVelocity, damping);
                _camera.orthographicSize = currentZoom;

                yield return(null);
            }
        }