public void MainCameraFade(float start, float to, float duration) { Camera mainCam = Camera.main; if (mainCam == null) { return; } CameraFadeEffect fadeCam = mainCam.transform.GetOrAddComponent <CameraFadeEffect>(); fadeCam.Fade(start, to, duration); fadeMainCamera = duration; }
public void Enable(float fadeTime) { if (fadeTime > 0) { CameraFadeEffect fadeCam = this.gameObject.AddComponent <CameraFadeEffect>(); fadeCam.Fade(1, 0, fadeTime); fadeCam.AutoDesroy = true; } cam.cullingMask = -1; //"Everything" CameraUtil.HideLayerName(cam, "UI"); CameraUtil.HideLayerName(cam, "UIModel"); CameraUtil.HideLayerName(cam, "Self"); CameraUtil.HideLayerName(cam, "Role"); CameraUtil.HideLayerName(cam, "Monster"); CameraUtil.HideLayerName(cam, "Jump"); CameraUtil.HideLayerName(cam, "Partner"); CameraUtil.HideLayerName(cam, "Npc"); CameraUtil.HideLayerName(cam, "TransparentBuilding"); CameraUtil.HideLayerName(cam, "SceneEntity"); CameraUtil.HideLayerName(cam, "RoleEffect"); cam.enabled = true; }