Exemple #1
0
        public static void LoadScene(string name, YAnimation animation)
        {
            Canvas canvas = CreateCanvas();

            IEnumerator Coroutin()
            {
                AsyncOperation ao = SceneManager.LoadSceneAsync(name);

                ao.allowSceneActivation = false;

                animation.OnAnimationEnd = (
                    () =>
                {
                    ao.allowSceneActivation = true;

                    animation.OnAnimationEnd = (
                        () =>
                    {
                        Destroy(canvas.gameObject);
                    });

                    animation.BackwardPlay();
                });

                animation.FowardPlay();

                yield return(null);
            }

            animation.transform.SetParent(canvas.transform);

            YCoroutin.instance.StartCoroutine(Coroutin());
        }
Exemple #2
0
        public static void LoadScene(string scene_name, string resource_path = "Default", float time = 1)
        {
            resource_path = base_path + "YScene/" + resource_path;

            GameObject go = GetObject(resource_path);

            YAnimation animation = go.GetComponent <YAnimation>();

            OnLoadStartScene.AddListener(() => { animation.PlayAnimation("FadeIn"); });

            OnLoadEndScene.AddListener(() => { animation.PlayAnimation("FadeOut"); });

            instance.StartCoroutine(
                CoroutainLoadScene(scene_name, time));
        }