private void UpdateShaderProperties() { GameObject currentContent = GalaxyExplorerManager.Instance.TransitionManager.CurrentActiveScene; if (currentContent) { SceneTransition sceneSizer = currentContent.GetComponent <SceneTransition>(); if (sceneSizer) { float scalar = sceneSizer.GetScalar(); Vector3 contentWP = currentContent.transform.position; Renderer renderer = GetComponentInChildren <Renderer>(); if (renderer) { Material mat = renderer.sharedMaterial; if (mat) { mat.SetFloat("_ContentRadius", scalar); mat.SetVector("_ContentWorldPos", contentWP); } } } } }
/// <summary> /// Callback when next scene is loaded /// Has the logic of the flow related to previous and next scene /// </summary> private IEnumerator NextSceneLoadedCoroutine() { GameObject nextSceneContent = FindContent(); ZoomInOutBehaviour.ZoomInIsDone = false; ZoomInOutBehaviour.ZoomOutIsDone = false; SceneTransition previousTransition = (prevSceneLoaded) ? prevSceneLoaded.GetComponentInChildren <SceneTransition>() : null; SceneTransition newTransition = nextSceneContent.GetComponentInChildren <SceneTransition>(); CurrentActiveScene = nextSceneContent; SetActivationOfTouchscript(false); DeactivateOrbitUpdater(newTransition, previousTransition, false); SetActivePOIRotationAnimator(false, previousTransition, newTransition); UpdateActivationOfPOIs(newTransition, false); UpdateActivationOfPOIs(previousTransition, false); // Scale new scene to fit inside the volume float scaleToFill = transformSource.transform.lossyScale.x; float targetSize = newTransition.GetScalar(scaleToFill); newTransition.transform.GetChild(0).localScale = Vector3.one * targetSize; // Initialize zoom in and out transition properties StartCoroutine(ZoomInOutBehaviour.ZoomInOutInitialization(nextSceneContent, prevSceneLoaded)); // In order for the next scene not being visible while the previous is fading, set scale to zero and deactivate all its colliders if (ZoomInOutBehaviour.GetNextScene) { ZoomInOutBehaviour.GetNextScene.transform.localScale = Vector3.zero; SetCollidersActivation(ZoomInOutBehaviour.GetNextScene.GetComponentsInChildren <Collider>(), false); } // Deactivate previous scene's colliders if (previousTransition) { SetCollidersActivation(previousTransition.GetComponentsInChildren <Collider>(), false); } yield return(new WaitForEndOfFrame()); StartCoroutine(ZoomInOutSimultaneouslyFlow(previousTransition, newTransition)); // wait until prev scene transition finishes while (!ZoomInOutBehaviour.ZoomOutIsDone) { yield return(null); } DeactivateOrbitUpdater(newTransition, previousTransition, true); UpdateActivationOfPOIs(newTransition, true); // Unload previous scene if (prevSceneLoaded != null) { UnloadScene(prevSceneLoaded.scene.name, true); } // Wait until next scene transition is done while (!ZoomInOutBehaviour.ZoomInIsDone) { yield return(null); } SetActivePOIRotationAnimator(true, previousTransition, newTransition); // Fade in pois of next scene if (introStage != IntroStage.kActiveIntro) { isFading = true; GalaxyExplorerManager.Instance.GeFadeManager.Fade(newTransition.GetComponentInChildren <POIMaterialsFader>(), GEFadeManager.FadeType.FadeIn, PoiFadeInDuration, POIOpacityCurveEndTransition); } while (isFading) { yield return(null); } yield return(new WaitForEndOfFrame()); while (GalaxyExplorerManager.Instance.VoManager.ShouldAudioBlockProgress) { yield return(null); } // Activate colliders of next scene if (ZoomInOutBehaviour.GetNextScene && introStage != IntroStage.kActiveIntro) { SetCollidersActivation(ZoomInOutBehaviour.GetNextScene.GetComponentsInChildren <Collider>(), true); } SetActivationOfTouchscript(true); inTransition = false; introStage = (introStage == IntroStage.kLastStageIntro) ? IntroStage.kInactiveIntro : introStage; yield return(null); }