public void ChangeState(string stateID, params object[] passThrough) { StateInfo stateInfo = GetStateInfoByName(stateID); if (stateInfo != null) { _PopCount = _StateStack.Count; _NewPush = new ClassPassthrough(stateInfo, Peek(), passThrough); } else { throw new StateNotFoundException(string.Format("Cannot change to state {0}. State not found!", stateID)); } }
public void PriorityUpdate() { // remove all pops bool bFirst = true; while (_PopCount > 0) { PopState_Internal(bFirst); _PopCount--; bFirst = false; } // push the new if (_NewPush != null) { // doing this in case we push a new in enter/resume ClassPassthrough toState = _NewPush; _NewPush = null; PushState_Internal(toState); } StateInfo topState = Peek(); if (topState != null) { _States[topState].PriorityUpdate(); } }