//选择一个合适的虚拟相机并把信息应用于unity 相机 private void ProcessActiveCamera() { if (!isActiveAndEnabled) { return; } VirtualCameraBase previousCam = activeCamera; activeCamera = ActiveVirtualCamera; if (activeCamera != null) { if (previousCam != null && previousCam.VirtualCameraGameObject == null) { return; } //进行转移 if (previousCam != null && previousCam != activeCamera) { float duration = 0; AnimationCurve curve = LookupBlendCurve(previousCam, activeCamera, out duration); activeBlend = CreateBlend(previousCam, activeCamera, curve, duration); // activeCamera.OnTransitionFromCamera(previousCam, DefaultWorldUp); } activeCamera.UpdateCameraInfo(DefaultWorldUp); CameraInfo info = activeCamera.CInfo; if (activeBlend != null) { if (activeBlend.IsComplete) { activeBlend = null; if (blendComplete != null) { blendComplete(); } } else { activeBlend.UpdateCameraState(DefaultWorldUp); info = activeBlend.CInfo; } } PushInfoToUnityCamera(info); } }
public void UpdateCameraState(Vector3 worldUp) { TimeInBlend += TimeMgr.unscaledDeltaTime; camA.UpdateCameraInfo(worldUp); camB.UpdateCameraInfo(worldUp); }