using UnityEngine;

public class AspectCameraPerspective : MonoBehaviour
{
	private Camera m_camera;

	private bool m_isSetFOV;

	public void UpdateFov()
	{
		m_isSetFOV = false;
	}

	private void Start()
	{
		m_camera = GetComponent<Camera>();
	}

	private void Update()
	{
		if (!m_isSetFOV && GameMgr.GetIns() != null && m_camera != null)
		{
			float num = 0f;
			float num2 = 0f;
			if (Screen.width > Screen.height)
			{
				num = Screen.width;
				num2 = Screen.height;
			}
			else
			{
				num = Screen.height;
				num2 = Screen.width;
			}
			float num3 = num / num2;
			if (num3 > 1.7777778f)
			{
				num3 = 1.7777778f;
			}
			m_camera.fieldOfView = Mathf.Atan2(1f, num3) * 57.29578f * 2f;
			m_isSetFOV = true;
		}
	}
}
