Esempio n. 1
0
        private IEnumerator Fade(FadeDirection fadeDirection)
        {
            float alpha        = (fadeDirection == FadeDirection.Out) ? 1 : 0;
            float fadeEndValue = (fadeDirection == FadeDirection.Out) ? 0 : 1;

            if (fadeDirection == FadeDirection.Out)
            {
                while (alpha >= fadeEndValue)
                {
                    SetColorImage(ref alpha, fadeDirection);
                    yield return(null);
                }
                fadeOutUIImage.enabled = false;
                OnSceneLoadComplete?.Invoke();
            }
            else
            {
                OnSceneLoadStarted?.Invoke();
                fadeOutUIImage.enabled = true;
                while (alpha <= fadeEndValue)
                {
                    SetColorImage(ref alpha, fadeDirection);
                    yield return(null);
                }
            }
        }
Esempio n. 2
0
        /* Will trigger a complete new scene load and will re-init the scene controller
         * to find new player starts and active cam portal possibilities. */
        public void DoScenePortal(string SceneName, string ProvidedStartLocation = GlobalConsts.DEFAULT_PLAYER_START)
        {
            if (string.IsNullOrEmpty(SceneName))
            {
                throw new UnityException(GlobalConsts.ERROR_STRING_EMPTY + transform.name);
            }

            playerStartName = ProvidedStartLocation;

            OnSceneLoadStarted?.Invoke();
            FadeIn(() => SceneManager.LoadScene(SceneName));
        }
Esempio n. 3
0
        /* Will trigger a camera change to new area within the same scene, will not cause
         * a re-init in the scene controller. */
        public void DoCamPortal(GameObject cameraContainerInput, Guid portalGUID)
        {
            /* Assumes that if no portal GUID is active, then we can't have left an area yet, so
             * we set that area from this point onwards. */
            if (activePortalGUID == Guid.Empty)
            {
                activePortalGUID = portalGUID;
            }

            if (activePortalGUID != portalGUID)
            {
                activePortalGUID = portalGUID;
                OnSceneLoadStarted?.Invoke();
                FadeInOut(() => RepositionCamera(cameraContainerInput), () => OnEndTransition());
            }
        }