示例#1
0
        public void transition(String stateName)
        {
            FiniteState state;

            if (myStates.TryGetValue(stateName, out state) == true)
            {
                if (myCurrentState != null)
                {
                    myCurrentState.onExit();
                }

                //Debug.print("AI: Transition to : {0}", stateName);
                myCurrentState = state;
                myCurrentState.onEntry();
            }
            else
            {
                Error.print("Cannot transition to state {0}", stateName);
            }
        }
示例#2
0
 public void addState(FiniteState state)
 {
     state.machine        = this;
     myStates[state.name] = state;
 }