//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);
            }
        }
示例#2
0
    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);
        }
    }
示例#3
0
        /// <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]);
            }
        }
示例#4
0
        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;
                }
            }
        }