public void AddFacet(IGameFacet facet, FacetTransition transition)
        {
            if (transition != null && facets.Count > 0)
            {
                if (!transition.IsSetup)
                    transition.Setup(facets.Peek(), facet);
                activeTransition = transition;
            }

            facets.Push(facet);
            facet.Initialize();
        }
 public void ReplaceMeWith(IGameFacet facet, FacetTransition transition)
 {
     IGameFacet top = facets.Pop();
     facets.Push(facet);
     if (activeTransition == null && transition != null)
     {
         activeTransition = transition;
         if (!activeTransition.IsSetup && facets.Count > 0)
         {
             activeTransition.Setup(top, facet);
         }
         activeTransition.OnCleanup += (iasr => { top.Cleanup(); });
     }
     facet.Initialize();
 }
        public void PopFacet(FacetTransition transition)
        {
            //Make sure to only remove the active facet
            IGameFacet top = facets.Pop();
            if (activeTransition == null && transition != null && facets.Count > 0)
            {
                activeTransition = transition;
                if (!activeTransition.IsSetup)
                {
                    activeTransition.Setup(top, facets.Peek());
                }

                //Cleanup the facet when we're done with it
                activeTransition.OnCleanup += (iasr => { top.Cleanup(); });
            }
            else
            {
                top.Cleanup();
            }
            if (facets.Count <= 0)
            {
                Game.Exit();
            }
        }