Ejemplo n.º 1
0
 public void AddState(IBotanyState state)
 {
     if (state == null)
     {
         return;
     }
     if (mStates.Count == 0)
     {
         mStates.Add(state);
         currentState = state;
         return;
     }
     foreach (IBotanyState s in mStates)
     {
         if (s.stateID == state.stateID)
         {
             return;
         }
     }
     mStates.Add(state);
 }
Ejemplo n.º 2
0
        public void PerformTransition(BotanyTransition trans)
        {
            if (trans == BotanyTransition.NullTansition)
            {
                return;
            }
            BotanyStateID nextStateID = CurrentState.GetOutPutState(trans);

            if (nextStateID == BotanyStateID.NullState)
            {
                return;
            }
            foreach (IBotanyState s in mStates)
            {
                if (s.stateID == nextStateID)
                {
                    currentState.DoBeforeLeaving();
                    currentState = s;
                    currentState.DoBeforeEntering();
                    return;
                }
            }
        }