Exemple #1
0
        public StateImpl(string name, uint uniqueID, BeginStateFun beginState, UpdateStateFun updateState, EndStateFun endState)
            : base(name, uniqueID)
        {
            m_BeginStateFunction  = beginState;
            m_UpdateStateFunction = updateState;
            m_EndStateFunction    = endState;

            if (m_BeginStateFunction == null)
            {
                Debug.LogError("Begin state is null in constructor of " + Name);
                Debug.Break();
            }

            if (m_UpdateStateFunction == null)
            {
                Debug.LogError("Update state is null in constructor of " + Name);
                Debug.Break();
            }
        }
Exemple #2
0
 // Optimization tip, Try to keep the state name as short as possible
 public State AddNewState(string name, BeginStateFun beginState, UpdateStateFun updateState, EndStateFun endState)
 {
     if (m_AllStates.ContainsKey(name))
     {
         Debug.LogError("State named " + name + " already exist");
     }
     else
     {
         uint      currID   = m_CurrId;
         StateImpl newState = new StateImpl(name, currID, beginState, updateState, endState);
         m_AllStates[name]     = newState;
         m_AllStatesID[currID] = newState;
         m_CurrId++;
         return(newState);
     }
     return(null);
 }