IEnumerable _RunTransitions(IGameView pLeaving, IGameView pEntering, IViewTransition pTransition, StringKeyDictionary pInfo) { if (pTransition != null) { //get transitions. ITransition transitionIntro = null; TransitionOutro transitionOutro = null; if (pEntering != null) { transitionIntro = pEntering.TransitionIntro(pTransition.TransitionInName, pInfo); } if (pLeaving != null) { transitionOutro = pLeaving.TransitionOutro(pTransition.TransitionOutName, pInfo); } //run transitions. if (pTransition.Simultaneous && transitionIntro != null && transitionOutro != null) { //Run both at the same time var startOut = StartCoroutine(transitionOutro.GetEnumerator(pInfo)); var startIn = StartCoroutine(transitionIntro.GetEnumerator(pInfo)); yield return(startOut); yield return(startIn); } else { if (transitionOutro != null) { var enumeratorOut = transitionOutro.GetEnumerator(pInfo); if (enumeratorOut != null) { while (enumeratorOut.MoveNext()) { yield return(enumeratorOut.Current); } } transitionOutro.moveViewToBackground(); } if (transitionIntro != null) { var enumeratorIn = transitionIntro.GetEnumerator(pInfo); if (enumeratorIn != null) { while (enumeratorIn.MoveNext()) { yield return(enumeratorIn.Current); } } } } } }