//-------------------------------------------------------------------------------------------------------------
 public virtual void OnStandByStart(STSIntermission sStandBy)
 {
     if (ActiveLog == true)
     {
         Debug.Log("<color=" + LogTagColor.ToString() + ">" + this.gameObject.scene.name + "</color> OnStandByStart() ");
     }
 }
 //-------------------------------------------------------------------------------------------------------------
 private bool WaitingToLauchNextScene(STSIntermission sIntermissionSceneStandBy)
 {
     if (sIntermissionSceneStandBy.AutoActiveNextScene == true)
     {
         LauchNextScene = true;
     }
     return(!LauchNextScene);
 }
 //-------------------------------------------------------------------------------------------------------------
 private bool StandByIsProgressing(STSIntermission sIntermissionSceneStandBy)
 {
     StandByTimer += Time.deltaTime;
     if (StandByTimer >= sIntermissionSceneStandBy.StandBySeconds)
     {
         StandByInProgress = false;
     }
     return(StandByInProgress);
 }
        //-------------------------------------------------------------------------------------------------------------
        public STSIntermission GetStandByParams(Scene sScene)
        {
            STSIntermission tTransitionStandByScript;

            if (STSIntermission.SharedInstanceExists(sScene))
            {
                tTransitionStandByScript = STSIntermission.SharedInstance(sScene);
            }
            else
            {
                tTransitionStandByScript = STSIntermission.SharedInstance(sScene);
                tTransitionStandByScript.StandBySeconds      = 5.0f;
                tTransitionStandByScript.AutoActiveNextScene = true;
            }

            /*
             * //Debug.Log("STSSceneManager GetStandByParams()");
             * STSIntermission tTransitionStandByScript = null;
             * GameObject[] tAllRootObjects = sScene.GetRootGameObjects();
             * // quick solution?!
             * foreach (GameObject tObject in tAllRootObjects)
             * {
             *  if (tObject.GetComponent<STSIntermission>() != null)
             *  {
             *      tTransitionStandByScript = tObject.GetComponent<STSIntermission>();
             *      break;
             *  }
             * }
             * // slower solution?!
             * if (tTransitionStandByScript == null)
             * {
             *  foreach (GameObject tObject in tAllRootObjects)
             *  {
             *      if (tObject.GetComponentInChildren<STSIntermission>() != null)
             *      {
             *          tTransitionStandByScript = tObject.GetComponent<STSIntermission>();
             *          break;
             *      }
             *  }
             * }
             * // no solution?!
             * if (tTransitionStandByScript == null)
             * {
             *  Scene tActual = SceneManager.GetActiveScene();
             *  SceneManager.SetActiveScene(sScene);
             *  GameObject tObjToSpawn = new GameObject(STSConstants.K_TRANSITION_Intermission_OBJECT_NAME);
             *  tObjToSpawn.AddComponent<STSSceneIntermissionController>();
             *  tTransitionStandByScript = tObjToSpawn.AddComponent<STSIntermission>();
             *  tTransitionStandByScript.StandBySeconds = 5.0f;
             *  tTransitionStandByScript.AutoLoadNextScene = true;
             *  SceneManager.SetActiveScene(tActual);
             * }
             */
            return(tTransitionStandByScript);
        }
Пример #5
0
        //-------------------------------------------------------------------------------------------------------------
        public override void OnInspectorGUI()
        {
            STSIntermission tTarget = (STSIntermission)target;

            //if (tTarget.gameObject.GetComponent<STSIntermissionInterface>() != null)
            //{
            serializedObject.Update();
            //DrawDefaultInspector();
            //EditorGUILayout.HelpBox("Determine the intermission scene parameters.", MessageType.Info);
            EditorGUILayout.PropertyField(SPStandBySeconds);
            EditorGUILayout.PropertyField(SPActiveLoadNextScene);
            serializedObject.ApplyModifiedProperties();
            //}
            //else
            //{
            //    EditorGUILayout.HelpBox("Need component with interface ISTSTransitionStandBy!", MessageType.Error);
            //}
        }
        //-------------------------------------------------------------------------------------------------------------
        private IEnumerator INTERNAL_ActiveSceneWithIntermissionAsync(STSTransitionData sTransitionData, string sActualActiveSceneName, string sSceneNameToActive, string sIntermissionSceneName)
        {
            TransitionInProgress = true;
            STSTransition tActualSceneParams = GetTransitionsParams(SceneManager.GetSceneByName(sActualActiveSceneName));

            STSTransitionInterface[] tActualSceneInterfaced = GetTransitionInterface(SceneManager.GetSceneByName(sActualActiveSceneName));
            STSTransitionInterface[] tOtherSceneInterfaced  = GetOtherTransitionInterface(SceneManager.GetSceneByName(sActualActiveSceneName));
            STSTransition            tNextSceneParams       = GetTransitionsParams(SceneManager.GetSceneByName(sSceneNameToActive));

            STSTransitionInterface[] tNextSceneInterfaced = GetTransitionInterface(SceneManager.GetSceneByName(sSceneNameToActive));
            EventSystemPrevent(false);
            foreach (STSTransitionInterface tInterfaced in tActualSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneDisable(sTransitionData);
            }
            AnimationTransitionOut(tActualSceneParams, sTransitionData);
            foreach (STSTransitionInterface tInterfaced in tActualSceneInterfaced)
            {
                tInterfaced.OnTransitionExitStart(sTransitionData, tActualSceneParams.EffectOnExit, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionExitStart(sTransitionData, tActualSceneParams.EffectOnExit, false);
            }
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            foreach (STSTransitionInterface tInterfaced in tActualSceneInterfaced)
            {
                tInterfaced.OnTransitionExitFinish(sTransitionData, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionExitFinish(sTransitionData, false);
            }
            // load transition scene async
            AsyncOperation tAsynchroneLoadIntermissionOperation;

            tAsynchroneLoadIntermissionOperation = SceneManager.LoadSceneAsync(sIntermissionSceneName, LoadSceneMode.Additive);
            tAsynchroneLoadIntermissionOperation.allowSceneActivation = false;
            while (tAsynchroneLoadIntermissionOperation.progress < 0.9f)
            {
                yield return(null);
            }
            // Intermission scene will be active
            tAsynchroneLoadIntermissionOperation.allowSceneActivation = true;
            while (!tAsynchroneLoadIntermissionOperation.isDone)
            {
                yield return(null);
            }
            // get Transition Scene
            Scene tIntermissionScene = SceneManager.GetSceneByName(sIntermissionSceneName);

            // Active the next scene as root scene
            SceneManager.SetActiveScene(tIntermissionScene);
            // disable audiolistener of preview scene
            CameraPrevent(true);
            AudioListenerPrevent(true);
            // get params
            STSTransition tIntermissionSceneParams = GetTransitionsParams(tIntermissionScene);

            STSTransitionInterface[]   tIntermissionSceneInterfaced = GetTransitionInterface(tIntermissionScene);
            STSIntermissionInterface[] tIntermissionInterfaced      = GetIntermissionInterface(tIntermissionScene);
            // disable the user interactions until fadein
            EventSystemEnable(tIntermissionScene, false);
            // Intermission scene is loaded
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneLoaded(sTransitionData);
            }
            // animation in Go!
            AnimationTransitionIn(tIntermissionSceneParams, sTransitionData);
            // animation in
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnEnter, tIntermissionSceneParams.InterEffectDuration, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnEnter, tIntermissionSceneParams.InterEffectDuration, false);
            }
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            // animation in Finish
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterFinish(sTransitionData, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterFinish(sTransitionData, false);
            }
            // enable the user interactions
            EventSystemEnable(tIntermissionScene, true);
            // enable the user interactions
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneEnable(sTransitionData);
            }
            // start stand by
            STSIntermission tIntermissionSceneStandBy = GetStandByParams(tIntermissionScene);

            foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
            {
                tInterfaced.OnStandByStart(tIntermissionSceneStandBy);
            }
            StandBy();
            while (StandByIsProgressing(tIntermissionSceneStandBy))
            {
                yield return(null);
            }
            // send call back for standby finished
            foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
            {
                tInterfaced.OnStandByFinish(tIntermissionSceneStandBy);
            }
            // Waiting to load the next Scene
            while (WaitingToLauchNextScene(tIntermissionSceneStandBy))
            {
                //Debug.Log ("StandByIsNotFinished loop");
                yield return(null);
            }
            // stanby is finish
            // disable user interactions on the transition scene
            EventSystemEnable(tIntermissionScene, false);


            // disable user interactions on the Intermission scene
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneDisable(sTransitionData);
            }
            // Intermission scene Transition Out GO!
            AnimationTransitionOut(tIntermissionSceneParams, sTransitionData);
            // Intermission scene Transition Out start
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnExit, tIntermissionSceneParams.InterEffectDuration, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnExit, tIntermissionSceneParams.InterEffectDuration, false);
            }
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            // Intermission scene Transition Out finished!
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionExitFinish(sTransitionData, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionExitFinish(sTransitionData, false);
            }
            // fadeout is finish
            // will unloaded the Intermission scene
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneWillUnloaded(sTransitionData);
            }
            AsyncOperation tAsynchroneUnloadTransition;

            tAsynchroneUnloadTransition = SceneManager.UnloadSceneAsync(sIntermissionSceneName);
            while (tAsynchroneUnloadTransition.progress < 0.9f)
            {
                yield return(null);
            }
            while (!tAsynchroneUnloadTransition.isDone)
            {
                yield return(null);
            }
            CameraPrevent(true);
            AudioListenerPrevent(true);
            SceneManager.SetActiveScene(SceneManager.GetSceneByName(sSceneNameToActive));
            AnimationTransitionIn(tNextSceneParams, sTransitionData);
            foreach (STSTransitionInterface tInterfaced in tNextSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tNextSceneParams.EffectOnEnter, tNextSceneParams.InterEffectDuration, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tNextSceneParams.EffectOnEnter, tNextSceneParams.InterEffectDuration, false);
            }
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            foreach (STSTransitionInterface tInterfaced in tNextSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterFinish(sTransitionData, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterFinish(sTransitionData, false);
            }
            EventSystemPrevent(true);
            foreach (STSTransitionInterface tInterfaced in tNextSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneEnable(sTransitionData);
            }
            TransitionInProgress = false;
        }
Пример #7
0
        //-------------------------------------------------------------------------------------------------------------
        private IEnumerator INTERNAL_ChangeScenesWithIntermission(
            string sIntermissionScene,
            string sActualActiveScene,
            string sNextActiveScene,
            List <string> sScenesToAdd,
            List <string> sScenesToRemove,
            STSTransitionData sTransitionData)
        {
            //AsyncOperation tAsyncOperation;
            Dictionary <string, AsyncOperation> tAsyncOperationList = new Dictionary <string, AsyncOperation>();

            //-------------------------------
            // ACTUAL SCENE DISABLE
            //-------------------------------
            TransitionInProgress = true;
            //-------------------------------
            Scene tActualScene = SceneManager.GetSceneByName(sActualActiveScene);
            //-------------------------------
            STSTransition tActualSceneParams = GetTransitionsParams(tActualScene);

            STSTransitionInterface[] tActualSceneInterfaced = GetTransitionInterface(tActualScene);
            STSTransitionInterface[] tOtherSceneInterfaced  = GetOtherTransitionInterface(tActualScene);
            // disable the user interactions
            EventSystemPrevent(false);
            // post scene is disable!
            //if (tActualSceneParams.Interfaced != null)
            //{
            //    tActualSceneParams.Interfaced.OnTransitionSceneDisable(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tActualSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneDisable(sTransitionData);
            }
            // scene start effect transition out!
            AnimationTransitionOut(tActualSceneParams, sTransitionData);
            // post scene start effect transition out!
            //if (tActualSceneParams.Interfaced != null)
            //{
            //    tActualSceneParams.Interfaced.OnTransitionExitStart(sTransitionData, tActualSceneParams.EffectOnExit);
            //}
            foreach (STSTransitionInterface tInterfaced in tActualSceneInterfaced)
            {
                tInterfaced.OnTransitionExitStart(sTransitionData, tActualSceneParams.EffectOnExit, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionExitStart(sTransitionData, tActualSceneParams.EffectOnExit, false);
            }
            // waiting effect will finish
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            // post scene finish effcet transition out
            //if (tActualSceneParams.Interfaced != null)
            //{
            //    tActualSceneParams.Interfaced.OnTransitionExitFinish(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tActualSceneInterfaced)
            {
                tInterfaced.OnTransitionExitFinish(sTransitionData, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherSceneInterfaced)
            {
                tInterfaced.OnTransitionExitFinish(sTransitionData, false);
            }
            //-------------------------------
            // Intermission SCENE LOAD AND ENABLE
            //-------------------------------
            // load transition scene async
            AsyncOperation tAsyncOperationIntermission = SceneManager.LoadSceneAsync(sIntermissionScene, LoadSceneMode.Additive);

            tAsyncOperationIntermission.allowSceneActivation = true;
            while (tAsyncOperationIntermission.progress < 0.9f)
            {
                yield return(null);
            }
            Scene tIntermissionScene = SceneManager.GetSceneByName(sIntermissionScene);

            while (!tAsyncOperationIntermission.isDone)
            {
                AudioListenerEnable(tIntermissionScene, false);
                yield return(null);
            }
            // get Transition Scene
            // Active the next scene as root scene
            SceneManager.SetActiveScene(tIntermissionScene);
            // disable audiolistener of preview scene
            CameraPrevent(true);
            AudioListenerPrevent(true);
            // disable the user interactions until fadein
            EventSystemEnable(tIntermissionScene, false);
            // get params
            STSTransition tIntermissionSceneParams = GetTransitionsParams(tIntermissionScene);

            STSTransitionInterface[]   tIntermissionSceneInterfaced = GetTransitionInterface(tIntermissionScene);
            STSIntermissionInterface[] tIntermissionInterfaced      = GetIntermissionInterface(tIntermissionScene);
            STSIntermission            tIntermissionSceneStandBy    = GetStandByParams(tIntermissionScene);
            //-------------------------------
            // COUNT SCENES TO REMOVE OR ADD
            //-------------------------------
            float tSceneCount   = sScenesToAdd.Count + sScenesToRemove.Count;
            int   tSceneCounter = 0;

            //-------------------------------
            // UNLOADED SCENES REMOVED
            //-------------------------------
            foreach (string tSceneToRemove in sScenesToRemove)
            {
                //Debug.Log("tSceneToRemove :" + tSceneToRemove);
                // fadeout is finish
                // will unloaded the  scene
                Scene                    tSceneToDelete           = SceneManager.GetSceneByName(tSceneToRemove);
                STSTransition            tSceneToDeleteParams     = GetTransitionsParams(tSceneToDelete);
                STSTransitionInterface[] tSceneToDeleteInterfaced = GetTransitionInterface(tSceneToDelete);
                //if (tSceneToDeleteParams.Interfaced != null)
                //{
                //    tSceneToDeleteParams.Interfaced.OnTransitionSceneWillUnloaded(sTransitionData);
                //}
                foreach (STSTransitionInterface tInterfaced in tSceneToDeleteInterfaced)
                {
                    tInterfaced.OnTransitionSceneWillUnloaded(sTransitionData);
                }
                if (SceneManager.GetSceneByName(tSceneToRemove).isLoaded)
                {
                    AsyncOperation tAsyncOperationRemove = SceneManager.UnloadSceneAsync(tSceneToRemove);

                    if (tAsyncOperationRemove != null)
                    {
                        tAsyncOperationRemove.allowSceneActivation = true; //? needed?
                                                                           //while (tAsyncOperationRemove.progress < 0.9f)
                                                                           //{
                                                                           //    if (tIntermissionSceneStandBy.Interfaced != null)
                                                                           //    {
                                                                           //        tIntermissionSceneStandBy.Interfaced.OnLoadingNextScenePercent(sTransitionData, tSceneToRemove, tSceneCounter, tAsyncOperationRemove.progress, (tSceneCounter + tAsyncOperationRemove.progress) / tSceneCount);
                                                                           //    }
                                                                           //    yield return null;
                                                                           //}
                                                                           //while (!tAsyncOperationRemove.isDone)
                                                                           //{
                                                                           //    yield return null;
                                                                           //}
                    }
                    else
                    {
                        Debug.LogWarning("UnloadSceneAsync is not possible for " + tSceneToRemove);
                    }
                }

                foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
                {
                    tInterfaced.OnUnloadScene(sTransitionData, tSceneToRemove, tSceneCounter, (tSceneCounter + 1.0F) / tSceneCount);
                }
                tSceneCounter++;
                //Debug.Log("tSceneToRemove :" + tSceneToRemove + " finish!");
            }
            //-------------------------------
            // Intermission start enter animation
            //-------------------------------
            // get params
            // Intermission scene is loaded
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionSceneLoaded(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneLoaded(sTransitionData);
            }
            // animation in Go!
            AnimationTransitionIn(tIntermissionSceneParams, sTransitionData);
            // animation in
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnEnter, tIntermissionSceneParams.InterEffectDuration);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnEnter, tIntermissionSceneParams.InterEffectDuration, true);
            }
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            // animation in Finish
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionEnterFinish(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterFinish(sTransitionData, true);
            }
            // enable the user interactions
            EventSystemEnable(tIntermissionScene, true);
            // enable the user interactions
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionSceneEnable(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneEnable(sTransitionData);
            }
            //-------------------------------
            // Intermission SCENE START STAND BY
            //-------------------------------
            // start stand by
            foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
            {
                tInterfaced.OnStandByStart(tIntermissionSceneStandBy);
            }
            StandBy();
            //-------------------------------
            // LOADED SCENES ADDED
            //-------------------------------
            foreach (string tSceneToLoad in sScenesToAdd)
            {
                //Debug.Log("tSceneToAdd :" + tSceneToAdd);
                Scene tSceneToAdd = SceneManager.GetSceneByName(tSceneToLoad);
                if (SceneManager.GetSceneByName(tSceneToLoad).isLoaded)
                {
                    foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
                    {
                        tInterfaced.OnSceneAllReadyLoaded(sTransitionData, tSceneToLoad, tSceneCounter, (tSceneCounter + 1.0F) / tSceneCount);
                    }
                    //Debug.Log("tSceneToAdd :" + tSceneToAdd + " allready finish!");
                    AudioListenerEnable(tSceneToAdd, false);
                    CameraPreventEnable(tSceneToAdd, false);
                    EventSystemEnable(tSceneToAdd, false);
                }
                else
                {
                    foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
                    {
                        tInterfaced.OnLoadingSceneStart(sTransitionData, tSceneToLoad, tSceneCounter, 0.0F, 0.0F);
                    }

                    AsyncOperation tAsyncOperationAdd = SceneManager.LoadSceneAsync(tSceneToLoad, LoadSceneMode.Additive);
                    tAsyncOperationList.Add(tSceneToLoad, tAsyncOperationAdd);
                    tAsyncOperationAdd.allowSceneActivation = false;
                    while (tAsyncOperationAdd.progress < 0.9f)
                    {
                        foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
                        {
                            tInterfaced.OnLoadingScenePercent(sTransitionData, tSceneToLoad, tSceneCounter, tAsyncOperationAdd.progress, (tSceneCounter + tAsyncOperationAdd.progress) / tSceneCount);
                        }
                        yield return(null);
                    }
                    foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
                    {
                        tInterfaced.OnLoadingSceneFinish(sTransitionData, tSceneToLoad, tSceneCounter, 1.0F, (tSceneCounter + 1.0F) / tSceneCount);
                    }
                    //Debug.Log("tSceneToAdd :" + tSceneToAdd + " 90%!");
                }
                tSceneCounter++;
            }
            //-------------------------------
            // Intermission STAND BY
            //-------------------------------
            while (StandByIsProgressing(tIntermissionSceneStandBy))
            {
                yield return(null);
            }
            // As soon as possible
            foreach (STSIntermissionInterface tInterfaced in tIntermissionInterfaced)
            {
                tInterfaced.OnStandByFinish(tIntermissionSceneStandBy);
            }
            // Waiting to load the next Scene
            while (WaitingToLauchNextScene(tIntermissionSceneStandBy))
            {
                //Debug.Log ("StandByIsNotFinished loop");
                yield return(null);
            }
            //-------------------------------
            // Intermission GO TO NEXT SCENE PROCESS
            //-------------------------------
            // stanby is finished And the next scene can be lauch
            // disable user interactions on the Intermission scene
            EventSystemEnable(tIntermissionScene, false);
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionSceneDisable(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneDisable(sTransitionData);
            }
            // Intermission scene Transition Out GO!
            AnimationTransitionOut(tIntermissionSceneParams, sTransitionData);
            // Intermission scene Transition Out start
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnExit, tIntermissionSceneParams.InterEffectDuration);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, tIntermissionSceneParams.EffectOnExit, tIntermissionSceneParams.InterEffectDuration, true);
            }
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            // Intermission scene Transition Out finished!
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionExitFinish(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionExitFinish(sTransitionData, true);
            }
            // fadeout is finish
            // will unloaded the Intermission scene
            //if (tIntermissionSceneParams.Interfaced != null)
            //{
            //    tIntermissionSceneParams.Interfaced.OnTransitionSceneWillUnloaded(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tIntermissionSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneWillUnloaded(sTransitionData);
            }
            //-------------------------------
            // ACTIVE ADDED SCENES
            //-------------------------------
            foreach (string tSceneToAdd in sScenesToAdd)
            {
                // scene is loaded!
                if (tAsyncOperationList.ContainsKey(tSceneToAdd))
                {
                    AsyncOperation tAsyncOperationAdd = tAsyncOperationList[tSceneToAdd];
                    Scene          tSceneToLoad       = SceneManager.GetSceneByName(tSceneToAdd);
                    tAsyncOperationAdd.allowSceneActivation = true;
                    while (!tAsyncOperationAdd.isDone)
                    {
                        AudioListenerEnable(tSceneToLoad, false);
                        yield return(null);
                    }
                    AudioListenerEnable(tSceneToLoad, false);
                    CameraPreventEnable(tSceneToLoad, false);
                    EventSystemEnable(tSceneToLoad, false);
                    STSTransitionInterface[] tSceneToLoadInterfaced = GetTransitionInterface(tSceneToLoad);
                    foreach (STSTransitionInterface tInterfaced in tSceneToLoadInterfaced)
                    {
                        tInterfaced.OnTransitionSceneLoaded(sTransitionData);
                    }
                }
            }
            //-------------------------------
            // NEXT SCENE PROCESS
            //-------------------------------
            Scene tNextActiveScene = SceneManager.GetSceneByName(sNextActiveScene);

            SceneManager.SetActiveScene(tNextActiveScene);
            AudioListenerPrevent(true);
            CameraPrevent(true);
            // get params
            STSTransition sNextSceneParams = GetTransitionsParams(tNextActiveScene);

            STSTransitionInterface[] tNextSceneInterfaced      = GetTransitionInterface(tNextActiveScene);
            STSTransitionInterface[] tOtherNextSceneInterfaced = GetOtherTransitionInterface(tNextActiveScene);
            EventSystemEnable(tNextActiveScene, false);
            // Next scene appear by fade in
            //-------------------------------
            // Intermission UNLOAD
            //-------------------------------
            AsyncOperation tAsyncOperationIntermissionUnload = SceneManager.UnloadSceneAsync(tIntermissionScene);

            if (tAsyncOperationIntermissionUnload != null)
            {
                tAsyncOperationIntermissionUnload.allowSceneActivation = true; //? needed?
                while (tAsyncOperationIntermissionUnload.progress < 0.9f)
                {
                    yield return(null);
                }
                while (!tAsyncOperationIntermissionUnload.isDone)
                {
                    yield return(null);
                }
            }
            else
            {
                Debug.LogWarning("UnloadSceneAsync is not possible for " + tIntermissionScene);
            }
            //-------------------------------
            // NEXT SCENE ENABLE
            //-------------------------------
            AnimationTransitionIn(sNextSceneParams, sTransitionData);
            //if (sNextSceneParams.Interfaced != null)
            //{
            //    sNextSceneParams.Interfaced.OnTransitionEnterStart(sTransitionData, sNextSceneParams.EffectOnEnter, sNextSceneParams.InterEffectDuration);
            //}
            foreach (STSTransitionInterface tInterfaced in tNextSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, sNextSceneParams.EffectOnEnter, sNextSceneParams.InterEffectDuration, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherNextSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterStart(sTransitionData, sNextSceneParams.EffectOnEnter, sNextSceneParams.InterEffectDuration, false);
            }
            while (AnimationFinished() == false)
            {
                yield return(null);
            }
            //if (sNextSceneParams.Interfaced != null)
            //{
            //    sNextSceneParams.Interfaced.OnTransitionEnterFinish(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tNextSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterFinish(sTransitionData, true);
            }
            foreach (STSTransitionInterface tInterfaced in tOtherNextSceneInterfaced)
            {
                tInterfaced.OnTransitionEnterFinish(sTransitionData, false);
            }
            // fadein is finish
            EventSystemPrevent(true);
            // next scene is enable
            //if (sNextSceneParams.Interfaced != null)
            //{
            //    sNextSceneParams.Interfaced.OnTransitionSceneEnable(sTransitionData);
            //}
            foreach (STSTransitionInterface tInterfaced in tNextSceneInterfaced)
            {
                tInterfaced.OnTransitionSceneEnable(sTransitionData);
            }
            // My transition is finish. I can do an another transition
            TransitionInProgress = false;
        }
 //-------------------------------------------------------------------------------------------------------------
 public void OnStandByFinish(STSIntermission sStandBy)
 {
     //throw new System.NotImplementedException();
 }