IEnumerator Lod1to0(Vector3 worldPos, int duration = 10, Action successCallBack = null) { State = LodState.Lod1to0; Vector3 oriLocal = MapCamera.transform.localPosition; float oriPitch = MapCamera.transform.localEulerAngles.x; float dstPitch = CameraHeight2Angle(worldPos.y); for (int i = 0; i < duration; ++i) { Vector3 local = Vector3.Lerp(oriLocal, worldPos, (i + 1) / (float)duration); float pitch = Mathf.Lerp(oriPitch, dstPitch, (i + 1) / (float)duration); CameraPitch = pitch; MoveCamera(local); yield return(null); } State = LodState.Lod0; CameraMask.SetActive(true); Lod0.gameObject.SetActive(true); // Lod0.OnCameraMove(Vector3.zero, Vector3.zero); Lod1.gameObject.SetActive(false); MoveCamera(worldPos); //App.ProxyMgr.MapProxy.GetBlockDataFromServer(); if (onDragUpdateHomecompass != null) { onDragUpdateHomecompass(); } if (successCallBack != null) { successCallBack(); } yield break; }
IEnumerator Lod0to1() { CameraMask.SetActive(false); Lod0.gameObject.SetActive(false); Lod0.CleanUp(); Lod1.gameObject.SetActive(true); Lod1.SyncMyCityFlagPos(); State = LodState.Lod0to1; Vector3 local = MapCamera.transform.localPosition; while (local.y < CameraHeightLod1to0) { local.y *= (1.0f + scaleSpeed * Time.deltaTime); MoveCamera(local); yield return(null); } State = LodState.Lod1; yield break; }