|
|
@ -8,6 +8,7 @@ namespace CoreGame.Render |
|
|
|
{ |
|
|
|
// public CinemachineVirtualCamera virtualCamera;
|
|
|
|
// public CinemachineBrain brain;
|
|
|
|
private Camera m_Camera; |
|
|
|
private Transform m_Target; |
|
|
|
|
|
|
|
internal Vector3 followPos; |
|
|
@ -21,12 +22,12 @@ namespace CoreGame.Render |
|
|
|
// todo 需要加绑点
|
|
|
|
protected override void Initialize(GameObject go, RenderEntity ent) |
|
|
|
{ |
|
|
|
m_Camera = Camera.main; |
|
|
|
// this.virtualCamera = go.GetComponentsInChildren<CinemachineVirtualCamera>()[0];
|
|
|
|
// brain = Camera.main.gameObject.GetComponent<CinemachineBrain>();
|
|
|
|
hasSynced = false; |
|
|
|
// virtualCamera.m_Lens.OrthographicSize = 8.5f; //调整相机大小
|
|
|
|
// m_CachePos = brain.OutputCamera.transform.position;
|
|
|
|
// m_Size = virtualCamera.m_Lens.OrthographicSize;
|
|
|
|
m_Size = m_Camera.orthographicSize; |
|
|
|
// var componentsInChildren = go.GetComponentsInChildren<Transform>();
|
|
|
|
// for (int i = 0; i < componentsInChildren.Length; i++)
|
|
|
|
// {
|
|
|
@ -42,24 +43,24 @@ namespace CoreGame.Render |
|
|
|
|
|
|
|
public override void Sync2Mono() |
|
|
|
{ |
|
|
|
// if (isInited == false)
|
|
|
|
// return;
|
|
|
|
//
|
|
|
|
// var brainOutputCamera = brain.OutputCamera;
|
|
|
|
if (isInited == false) |
|
|
|
return; |
|
|
|
|
|
|
|
var brainOutputCamera = m_Camera; |
|
|
|
// brainOutputCamera.transform.position = new Vector3(followPos.x, followPos.y, m_CachePos.z);
|
|
|
|
// hasSynced = true;
|
|
|
|
// var width = Screen.width;
|
|
|
|
// var height = Screen.height;
|
|
|
|
// if (width == m_Width && height == m_Height)
|
|
|
|
// return;
|
|
|
|
//
|
|
|
|
// m_Width = width;
|
|
|
|
// m_Height = height;
|
|
|
|
// var f = height * 1.0f / width;
|
|
|
|
// if (f > m_NormalRatio)
|
|
|
|
// {
|
|
|
|
// brainOutputCamera.orthographicSize = m_Size * f / m_NormalRatio;
|
|
|
|
// }
|
|
|
|
hasSynced = true; |
|
|
|
var width = Screen.width; |
|
|
|
var height = Screen.height; |
|
|
|
if (width == m_Width && height == m_Height) |
|
|
|
return; |
|
|
|
|
|
|
|
m_Width = width; |
|
|
|
m_Height = height; |
|
|
|
var f = height * 1.0f / width; |
|
|
|
if (f > m_NormalRatio) |
|
|
|
{ |
|
|
|
brainOutputCamera.orthographicSize = m_Size * f / m_NormalRatio; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |