Example #1
0
 public void DeleteTransition(BotanyTransition trans)
 {
     if (mMap.ContainsKey(trans) == false)
     {
         return;
     }
     mMap.Remove(trans);
 }
Example #2
0
 public BotanyStateID GetOutPutState(BotanyTransition trans)
 {
     if (mMap.ContainsKey(trans) == false)
     {
         return(BotanyStateID.NullState);
     }
     else
     {
         return(mMap[trans]);
     }
 }
Example #3
0
 public void AddTransition(BotanyTransition trans, BotanyStateID id)
 {
     if (trans == BotanyTransition.NullTansition)
     {
         return;
     }
     if (id == BotanyStateID.NullState)
     {
         return;
     }
     if (mMap.ContainsKey(trans))
     {
         return;
     }
     mMap.Add(trans, id);
 }
Example #4
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;
                }
            }
        }