Ejemplo n.º 1
0
        void doTransition(String gsName)
        {
            if (myStateStack.Count > 0)
            {
                if (gsName == myStateStack.Peek().name)
                {
                    return;
                }

                GameState oldState = myStateStack.Pop();
                if (oldState != null)
                {
                    oldState.onExit();
                }
            }

            GameState newState;

            if (myGameStates.TryGetValue(gsName, out newState) == false)
            {
                throw new Exception("Unknown state " + gsName);
            }

            newState.onEnter();
            myStateStack.Push(newState);
        }
Ejemplo n.º 2
0
 public void pop()
 {
     if (state != null)
     {
         state.onExit();
         Game.instance().getWindow().clean();
         state = null;
     }
 }
Ejemplo n.º 3
0
        public void doPop()
        {
            if (myStateStack.Count == 0)
            {
                throw new Exception("Cannot pop an empty game state stack");
            }

            GameState gs = myStateStack.Pop();

            gs.onExit();
        }