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); } }