Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            if (facets.Count <= 0) //stack is empty
            {
                Game.Exit();
                return; //evidently Game.Exit() lets things run to completion...hrm.
            }
            #if XBOX
            if (Guide.IsVisible) return;
            #endif

            // TODO: Add your update code here
            IGameFacet top = facets.Peek();
            top.Update(gameTime);

            if (activeTransition != null)
            {
                activeTransition.Update(gameTime);
                if (activeTransition.Finished)
                {
                    activeTransition.Cleanup();
                    activeTransition = null;
                }
            }

            base.Update(gameTime);
        }
Esempio n. 4
0
        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();
            }
        }