コード例 #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);
 }
コード例 #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;
                }
            }
        }