Esempio n. 1
0
        /// <summary>
        /// this method signals a cleanup (duh) and notifies event listeners
        /// </summary>
        private void cleanup()
        {
            if (_instance == null)
            {
                return;
            }

            if (onTransitionComplete != null)
            {
                onTransitionComplete();
            }

            _transitionKitDelegate = null;
            context = null;

            // if we are keeping TK alive we only need to free resources and not delete ourself completely
            if (keepTransitionKitInstance)
            {
                GetComponent <MeshRenderer>().material.mainTexture = null;
                GetComponent <MeshFilter>().mesh = null;
                gameObject.SetActive(false);
                transitionKitCamera.enabled = false;
            }
            else
            {
                Destroy(gameObject);
                _instance = null;
            }
        }
        public IEnumerator onScreenObscured(TransitionEngine transitionKit)
        {
            transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;
            transitionKit.material.color = fadeToColor;

            if (nextScene >= 0)
            {
                SceneManager.LoadSceneAsync(nextScene);
            }

            yield return(transitionKit.StartCoroutine(transitionKit.tickProgressPropertyInMaterial(duration)));

            transitionKit.makeTextureTransparent();

            if (fadedDelay > 0)
            {
                yield return(new WaitForSeconds(fadedDelay));
            }

            // we dont transition back to the new scene unless it is loaded
            if (nextScene >= 0)
            {
                yield return(transitionKit.StartCoroutine(transitionKit.waitForLevelToLoad(nextScene)));
            }

            yield return(transitionKit.StartCoroutine(transitionKit.tickProgressPropertyInMaterial(duration, true)));
        }
        public IEnumerator onScreenObscured(TransitionEngine transitionKit)
        {
            transitionKit.transitionKitCamera.clearFlags = CameraClearFlags.Nothing;

            // set some material properties
            transitionKit.material.SetFloat("_Size", size);
            transitionKit.material.SetFloat("_WindVerticalSegments", windVerticalSegments);

            // we dont transition back to the new scene unless it is loaded
            if (nextScene >= 0)
            {
                SceneManager.LoadSceneAsync(nextScene);
                yield return(transitionKit.StartCoroutine(transitionKit.waitForLevelToLoad(nextScene)));
            }

            yield return(transitionKit.StartCoroutine(transitionKit.tickProgressPropertyInMaterial(duration)));
        }