IEnumerator TransitionParallel(GameObject fromGameObject, GameObject toGameObject)
        {
            float transitionOutTime = 0;

            if (fromGameObject != null)
            {
                if (TransitionHelper.ContainsTransition(fromGameObject))
                {
                    var transitions = TransitionHelper.TransitionOut(fromGameObject);
                    transitionOutTime = TransitionHelper.GetTransitionOutTime(transitions);
                }
            }
            if (toGameObject != null)
            {
                toGameObject.SetActive(true);
                if (TransitionHelper.ContainsTransition(toGameObject))
                {
                    TransitionHelper.TransitionIn(toGameObject);
                }
            }

            // wait for transition out to complete before we disable.
            if (!Mathf.Approximately(0, transitionOutTime))
            {
                yield return(new WaitForSeconds(transitionOutTime));
            }

            if (fromGameObject != null)
            {
                fromGameObject.SetActive(false);
            }
        }
        /// <summary>
        /// Transition out using transitions on the specified gameobjects
        /// </summary>
        /// <param name="transitionGameObjects"></param>
        public float TransitionOut(UnityEngine.GameObject[] transitionGameObjects)
        {
            var transitionBases = new List <TransitionBase>();

            foreach (var transitionGameObject in transitionGameObjects)
            {
                transitionBases.AddRange(TransitionHelper.TransitionOut(transitionGameObject));
            }
            var delay = TransitionHelper.GetTransitionOutTime(transitionBases);

            return(delay);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Complete the dialog
        /// </summary>

        public void Done()
        {
            // show / transition in and when done call coroutine
            float transitionTime = 0;

#if BEAUTIFUL_TRANSITIONS
            //if (TransitionHelper.ContainsTransition(gameObject))
            //{
            transitionTime = TransitionHelper.GetTransitionOutTime(TransitionHelper.TransitionOut(gameObject));
            //}
#endif
            StartCoroutine(CoRoutines.DelayedCallback(transitionTime, DoneFinished));
        }
Exemplo n.º 4
0
 IEnumerator TransitionOutIn(GameObject oldGameObject, GameObject newGameObject)
 {
     if (oldGameObject != null)
     {
         if (TransitionHelper.ContainsTransition(oldGameObject))
         {
             var transitions = TransitionHelper.TransitionOut(oldGameObject);
             yield return(new WaitForSeconds(TransitionHelper.GetTransitionOutTime(transitions)));
         }
         oldGameObject.SetActive(false);
     }
     newGameObject.SetActive(true);
 }
        public IEnumerator DemoCameraInternal(TransitionBase transitionBase)
        {
            // make sure these are set in the materials.
            SetColor(_color);
            SetShowTexture(_showTexture);
            SetWipeTexture();

            float transitionTime = TransitionHelper.GetTransitionOutTime(new List <TransitionBase> {
                transitionBase
            });

            transitionBase.InitTransitionOut();
            transitionBase.TransitionOut();
            yield return(new WaitForSeconds(transitionTime + 0.5f));

            transitionBase.TransitionIn();
        }
 IEnumerator TransitionOutIn(GameObject fromGameObject, GameObject toGameObject)
 {
     if (fromGameObject != null)
     {
         // is an out transition then run and wait for completion
         if (TransitionHelper.ContainsTransition(fromGameObject))
         {
             var transitions       = TransitionHelper.TransitionOut(fromGameObject);
             var transitionOutTime = TransitionHelper.GetTransitionOutTime(transitions);
             yield return(new WaitForSeconds(transitionOutTime));
         }
         fromGameObject.SetActive(false);
     }
     if (toGameObject != null)
     {
         toGameObject.SetActive(true);
         if (TransitionHelper.ContainsTransition(toGameObject))
         {
             TransitionHelper.TransitionIn(toGameObject);
         }
     }
 }