private void ResetTransitions() { currentTransition = null; nextTransition = null; nextState = null; }
public void Push(BaseGameState state, ITransition transOut = null, ITransition transIn = null) { pushNextState = true; pushBuffer = state; TransitionToNextState(transOut, transIn); }
private void PushState() { // No states? set the state if (states.Count <= 0 && nextState == null) { nextState = pushBuffer; pushBuffer = null; SetState(); return; } // Our new state is full screen, the previous states have lost focus if (!pushBuffer.IsOverlay) { foreach (var state in states) state.OnLostFocus(); } markToPush.Enqueue (pushBuffer); }
private void PopState() { bool needNewInputReceiver = states[states.Count - 1] == latestInputReceiver; states[states.Count-1].OnLostFocus(); states.RemoveAt (states.Count-1); if (needNewInputReceiver) latestInputReceiver = FindInputReceiver (); }
public void Update(GameTime gameTime) { // TODO: Find a better way to handle this latestInputReceiver = FindInputReceiver(); if (latestInputReceiver != null) latestInputReceiver.HandleInput (gameTime); foreach (var state in states) state.Update (gameTime); if (currentTransition != null) UpdateTransition(gameTime); // Pop all marked states, you can't do this during Update() if (markToPopCount > 0) { for (int i=0; i < markToPopCount; i++) PopState(); markToPopCount = 0; } // Set state if (nextState != null) { foreach (var state in states) state.OnLostFocus (); states.Clear (); states.Add (nextState); nextState.OnFocus (); nextState = null; } // Push all new states on to the stack outside of Update() while (markToPush.Count > 0) { states.Add (markToPush.Dequeue ()); CurrentState.OnFocus(); } }
public void Set(string name, ITransition transOut = null, ITransition transIn = null) { pushNextState = false; nextState = stateMap[name]; TransitionToNextState (transOut, transIn); }
public void Push(string name, ITransition transOut = null, ITransition transIn = null) { pushNextState = true; pushBuffer = stateMap[name]; TransitionToNextState (transOut, transIn); }