30 lines
917 B
C#
30 lines
917 B
C#
using Cinemachine;
|
|
using UnityEngine;
|
|
|
|
namespace RND
|
|
{
|
|
public abstract class BaseCameraCorrector : MonoBehaviour
|
|
{
|
|
public float DefaultRatio => _defaultResolution.x / _defaultResolution.y;
|
|
public Camera Camera => _camera;
|
|
public Vector2 DefaultResolution => _defaultResolution;
|
|
|
|
public CinemachineVirtualCamera VirtualCamera => _virtualCamera;
|
|
|
|
private Camera _camera;
|
|
private CinemachineVirtualCamera _virtualCamera;
|
|
private Vector2 _defaultResolution;
|
|
|
|
public void Init(Camera camera, Vector2 defaultResolution)
|
|
{
|
|
_camera = camera;
|
|
_defaultResolution = defaultResolution;
|
|
_virtualCamera = GetComponent<CinemachineVirtualCamera>();
|
|
|
|
OnInit();
|
|
}
|
|
|
|
protected virtual void OnInit(){}
|
|
public abstract void SyncCameraProperty(float wightOrHeight);
|
|
}
|
|
} |