using UnityEngine;

public class CameraZoomer : MonoBehaviour
{
   [SerializeField] private float m_maxFOV = 80.0f;
   [SerializeField] private float m_minFOV = 60.0f;
   [SerializeField] private Camera m_camera = default;
   [SerializeField] private float m_zoomSpeed = 5.0f;

   private float m_interpolationValue = 0.0f;
   
   private void Update()
   {
      if (InputManager.Zooming)
      {
         if (m_interpolationValue < 1.0f) m_interpolationValue +=  m_zoomSpeed * Time.deltaTime;
      }
      else
      {
         if (m_interpolationValue > 0.0f) m_interpolationValue -=  m_zoomSpeed *  Time.deltaTime;
      }
      m_camera.fieldOfView = Mathf.Lerp(m_minFOV, m_maxFOV, m_interpolationValue);
   }
}
