/// <summary> /// Change the current state to the state at stateID /// </summary> /// <param name="stateID">The key of the desired state</param> public void ChangeState(String stateID) { if (states.ContainsKey(stateID) & currentStateID != stateID) { currentState = states[stateID]; currentStateID = stateID; } }
/// <summary> /// Change the current state to the state at stateID and calls the transition functions /// </summary> /// <param name="stateID">The key of the desired state</param> /// /// <param name="transitionAction">The function to call as the state changes</param> public void ChangeState(String stateID, TransitionAction transitionAction) { if (states.ContainsKey(stateID) & currentStateID != stateID) { currentState = states[stateID]; currentStateID = stateID; transitionAction(this); } }
private iFSM(iFSM parent) { actions = new List <StateAction>(); states = new Dictionary <String, iFSM>(); this.myParent = parent; }