using System;
using UnityEngine;

public class DanceFpsCam : PartsMgrBase
{
	protected override void Start()
	{
		base.Start();
		base.IsActive &= (!GameMain.Instance.VRMode && DanceSetting.Settings.FPSCamMode);
		if (!base.IsActive)
		{
			base.enabled = false;
			return;
		}
		this.m_OrijinFov = GameMain.Instance.MainCamera.camera.fieldOfView;
		GameMain.Instance.VRDummyMode = true;
		GameMain.Instance.OvrInit();
		UICamera.isDisableRightClick = true;
		GameMain.Instance.OvrMgr.OvrCamera.ChangeControllerNew(true);
		GameMain.Instance.OvrMgr.OvrCamera.IsForceRightClickUiToggle = true;
		GameMain.Instance.MainCamera.SetTargetPos(this.m_InitCamPos, true);
		GameMain.Instance.MainCamera.SetAroundAngle(this.m_InitCamRot, true);
		GameMain.Instance.MainCamera.SetDistance(this.m_InitDistance, true);
		GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Free, false);
	}

	private void OnDestroy()
	{
		if (base.IsActive)
		{
			UICamera.isDisableRightClick = false;
			GameMain.Instance.OvrMgr.OvrCamera.ChangeControllerNew(false);
			GameMain.Instance.OvrMgr.OvrCamera.IsForceRightClickUiToggle = false;
			GameMain.Instance.VRDummyMode = false;
			GameMain.Instance.OvrUninit();
			GameMain.Instance.MainCamera.camera.fieldOfView = this.m_OrijinFov;
		}
	}

	public override void EndAction()
	{
		GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
	}

	[SerializeField]
	[Header("移動")]
	private float m_MoveSpeed = 5f;

	[SerializeField]
	[Header("回転")]
	private float m_RotSpeed = 30f;

	[SerializeField]
	[Header("X角度制限")]
	private float m_AngleXMax = 45f;

	[SerializeField]
	[Header("カメラ初期設定")]
	private Vector3 m_InitCamPos;

	[SerializeField]
	private Vector2 m_InitCamRot;

	[SerializeField]
	private float m_InitDistance;

	private Vector3 m_RotAngle;

	private float m_OrijinFov;
}
