예제 #1
0
파일: Manager.cs 프로젝트: kuviman/Q
 public Manager(params State[] states)
 {
     for (int i = states.Length - 1; i >= 0; i--)
     {
         ManagedStack.Push(states[i]);
     }
 }
예제 #2
0
파일: Manager.cs 프로젝트: kuviman/Q
            public override void Update(double dt)
            {
                base.Update(dt);
                while (ManagedStack.Count != 0)
                {
                    if (ManagedStack.Peek() == null || ManagedStack.Peek().Closed)
                    {
                        ManagedStack.Pop();
                    }
                    else if (ManagedStack.Peek().NextState != null)
                    {
                        ManagedStack.Push(ManagedStack.Pop().NextState);
                    }
                    else
                    {
                        break;
                    }
                }
                CurrentState = ManagedStack.Count == 0 ? null : ManagedStack.Peek();
                if (CurrentState != null)
                {
                    CurrentState.Update(dt);
                    while (CurrentState.StateStack.Count != 0)
                    {
                        PushState(CurrentState.StateStack.Pop());
                    }
                }
                else
                {
                    Close();
                }

                if (CurrentState != prevState)
                {
                    StateChanged();
                    prevState = CurrentState;
                }
            }
예제 #3
0
파일: Manager.cs 프로젝트: kuviman/Q
 public new void PushState(State state)
 {
     ManagedStack.Push(state);
 }