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); }
private void AddToObjects(UNResourceObject resObj) { var list = UNList <UNResourceObject> .New(); list.Add(resObj); m_objs.Add(resObj.m_key, list); }
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); } }
private void LoadGameManager <T> () where T : UNManager, new() { var mgr = new T(); m_managers.Add(typeof(T), mgr); mgr.Init(); }
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); }
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); }
public void AddBehaviorsTransRule(UNList <UNBehaviorType> fromTypes, UNBehaviorType toType) { m_behaviorsTransRules.Add(toType, fromTypes); }