//this gets all the actions inside the state and loops them. private void ProcessStateAction(FSMState state, StateActionProcessor actionProcessor) { FSMState currentStateOnInvoke = this.currentState; IEnumerable <FSMAction> actions = state.GetActions(); foreach (FSMAction action in actions) { if (this.currentState != currentStateOnInvoke) { break; } actionProcessor(action); } }
private void ProcessStateAction(FSMState state, StateActionProcessor actionProcessor) { FSMState currentStateOnInvoke = currentState; foreach (var action in state.Actions) { // Avoid processing the action when the state has changed if (currentState != currentStateOnInvoke) { break; } actionProcessor(action); } }
/// <summary> /// This gets all the actions that is inside the state and loop them. /// </summary> /// <param name="state">State.</param> /// <param name="actionProcessor">Action processor.</param> private void ProcessStateAction(FSMState state, StateActionProcessor actionProcessor) { FSMState currentStateOnInvoke = this.currentState; List <FSMAction> actions = state.GetActions(); //foreach (FSMAction action in actions) for (int i = 0; i < actions.Count; i++) { if (this.currentState != currentStateOnInvoke) { break; } actionProcessor(actions[i]); } }
private void ProcessStateActions(FsmState state, StateActionProcessor actionProcessor) { FsmState currentStateOnInvoke = this.currentState; IEnumerable <FsmAction> actions = state.GetActions(); foreach (FsmAction action in actions) { actionProcessor(action); if (this.currentState != currentStateOnInvoke) { // this means that the action processing caused a state change // we don't continue with the rest of the actions break; } } }