Exemple #1
0
 private void InitStateCbs()
 {
     if (m_stateCbs.IsNull())
     {
         m_stateCbs = UNDictionary <UNBehaviorStateType, UNBehaviorChangeToState> .New();
     }
     m_stateCbs.Add(UNBehaviorStateType.Wait, Wait);
     m_stateCbs.Add(UNBehaviorStateType.Execute, Execute);
     m_stateCbs.Add(UNBehaviorStateType.Finish, Finish);
 }
Exemple #2
0
    private void AddToObjects(UNResourceObject resObj)
    {
        var list = UNList <UNResourceObject> .New();

        list.Add(resObj);
        m_objs.Add(resObj.m_key, list);
    }
Exemple #3
0
 public T CreateObject <T>()
     where T : UNObject, new()
 {
     if (m_objs.TryGetValue(typeof(T), out m_objGetList))
     {
         for (int i = 0; i < m_objGetList.Count; ++i)
         {
             if (m_objGetList[i].m_state == UNObjectStateType.Alive)
             {
                 continue;
             }
             m_objGetList[i].m_state = UNObjectStateType.Alive;
             return(m_objGetList[i] as T);
         }
         T obj = new T();
         obj.m_state = UNObjectStateType.Alive;
         m_objGetList.Add(obj);
         return(obj);
     }
     else
     {
         T obj = new T();
         obj.m_state = UNObjectStateType.Alive;
         var objList = new UNList <UNObject>();
         objList.Add(obj);
         m_objs.Add(typeof(T), objList);
         return(obj);
     }
 }
Exemple #4
0
    private void LoadGameManager <T> ()
        where T : UNManager, new()
    {
        var mgr = new T();

        m_managers.Add(typeof(T), mgr);
        mgr.Init();
    }
Exemple #5
0
    public void DispatchEvent(EventType type, object[] pars)
    {
        UNList <object[]> objs = null;

        if (!m_triggers.TryGetValue(type, out objs))
        {
            objs = UNList <object[]> .New();

            m_triggers.Add(type, objs);
        }
        objs.Add(pars);
    }
Exemple #6
0
    public void AddEventListener(EventType type, EventCallBack cb)
    {
        UNList <EventCallBack> cbs = null;

        if (!m_listeners.TryGetValue(type, out cbs))
        {
            cbs = UNList <EventCallBack> .New();

            m_listeners.Add(type, cbs);
        }
        cbs.Add(cb);
    }
Exemple #7
0
 public void AddBehaviorsTransRule(UNList <UNBehaviorType> fromTypes, UNBehaviorType toType)
 {
     m_behaviorsTransRules.Add(toType, fromTypes);
 }