Example #1
0
    public void process(TFSMWorkingData wData)
    {
        if (wData._isFirstUpdate)
        {
            wData._currentState = wData._defaultState;
            if (wData._currentState != null)
            {
                wData._currentState.enter(wData);
                wData._isFirstUpdate = false;
            }
        }
        TFSMState newState = wData._currentState;

        if (wData._stimulus != null)
        {
            newState        = wData._stimulus.getGoalState();
            wData._stimulus = null;
        }
        if (newState != wData._currentState)
        {
            if (wData._currentState != null)
            {
                wData._currentState.exit(wData);
            }
            wData._currentState = newState;
            if (wData._currentState != null)
            {
                wData._currentState.enter(wData);
            }
        }
        if (wData._currentState != null)
        {
            wData._currentState.execute(wData);
        }
    }
Example #2
0
 public TFSMMachine addState(string id, TFSMState state)
 {
     if (_stateLinks.ContainsKey(id)) {
         TLogger.WARNING("name conflict for this state: "+ id);
         return this;
     }
     state.name = id;
     state.stateMachine = this;
     _states.Add(id, state);
     return this;
 }
Example #3
0
 public TFSMMachine addState(string id, TFSMState state)
 {
     if (_stateLinks.ContainsKey(id))
     {
         TLogger.WARNING("name conflict for this state: " + id);
         return(this);
     }
     state.name         = id;
     state.stateMachine = this;
     _states.Add(id, state);
     return(this);
 }
Example #4
0
 public TFSMLink(TFSMState from, TFSMState to)
 {
     _from = from;
     _to = to;
 }
Example #5
0
 public TFSMLink(TFSMState from, TFSMState to)
 {
     _from = from;
     _to   = to;
 }