public void DispatchMesssage(FSMTransitionType msg, BaseFSM receiverId, bool condition)
    {
        CharacterMessage message = new CharacterMessage(msg, receiverId, condition);

        if (message.condition)
        {
            message.Receiver.PerformTransition(message.Msg);
        }
    }
Exemplo n.º 2
0
 public void DeleteTransition(FSMTransitionType trans)
 {
     if (map.ContainsKey(trans))
     {
         map.Remove(trans);
         return;
     }
     Debug.LogError("ERROR: Transition passed was not on this State's List");
 }
Exemplo n.º 3
0
 public void AddTransition(FSMTransitionType transition, FSMStateType id)
 {
     if (map.ContainsKey(transition))
     {
         Debug.LogWarning("ERROR: transition is already inside the map");
         return;
     }
     map.Add(transition, id);
     Debug.Log("Added : " + transition + " with ID : " + id);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 转换状态
        /// </summary>
        /// <param name="trans"></param>
        public void PerformTransition(FSMTransitionType trans)
        {
            FSMStateType id = currentState.GetOutputState(trans);

            currentStateID = id;

            foreach (FSMState state in fsmStates)
            {
                if (state.ID == currentStateID)
                {
                    Debug.Log(currentStateID);
                    currentState = state;
                    break;
                }
            }
        }
 public CharacterMessage(FSMTransitionType msg, BaseFSM rid, bool con)
 {
     Msg       = msg;
     Receiver  = rid;
     condition = con;
 }
Exemplo n.º 6
0
 public FSMStateType GetOutputState(FSMTransitionType trans)
 {
     return(map[trans]);
 }