Пример #1
0
    private void LateUpdate()
    {
        if (_playerBody == null || _camera == null)
        {
            return;
        }

        _playerBody = GameObject.FindGameObjectWithTag("Player").GetComponent <Rigidbody2D>();

        float zoom     = CustomExtensions.Remap(_playerBody.velocity.magnitude, 0, 40, MinZoom, MaxZoom);
        float zoomDamp = Mathf.Lerp(_camera.m_Lens.OrthographicSize, zoom, (1 - ZoomSmooth) / 100);

        _camera.m_Lens.OrthographicSize = zoomDamp;
    }