38 lines
907 B
C#
38 lines
907 B
C#
using UnityEditor.Rendering;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class CameraManager : MonoBehaviour
|
|
{
|
|
[SerializeField] private PlayerCameraRig _currentCameraRig; //현재 활성화된 플레이어의 카메라 묶음 조종객체
|
|
|
|
private float minFOV = 40f;
|
|
private float maxFOV = 100f;
|
|
|
|
private void Awake()
|
|
{
|
|
|
|
}
|
|
|
|
public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
|
{
|
|
|
|
}
|
|
|
|
public void SetCameraRig(PlayerCameraRig cameraRig)
|
|
{
|
|
_currentCameraRig = cameraRig;
|
|
}
|
|
|
|
public void ZoomCamera(float offset)
|
|
{
|
|
_currentCameraRig.CurrentFOV = Mathf.Clamp(_currentCameraRig.CurrentFOV - offset, minFOV,maxFOV);
|
|
}
|
|
|
|
public Vector3 GetViewportPointToRayEndPoint(Vector3 vpPoint,float rayLength)
|
|
{
|
|
Ray ray = Camera.main.ViewportPointToRay(vpPoint);
|
|
return ray.GetPoint(rayLength);
|
|
}
|
|
}
|