Beispiel #1
0
    public override void Init()
    {
        base.Init();

        m_listeners = UNDictionary <EventType, UNList <EventCallBack> > .New();

        m_triggers = UNDictionary <EventType, UNList <object[]> > .New();
    }
Beispiel #2
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);
 }
Beispiel #3
0
 public void CopyTo(ref UNDictionary <TKey, TValue> toDict)
 {
     if (toDict.IsNull())
     {
         toDict = new UNDictionary <TKey, TValue>();
     }
     toDict.Clear();
     for (int i = 0; i < m_keys.Count; ++i)
     {
         toDict.Add(m_keys[i], m_dict[m_keys[i]]);
     }
 }
Beispiel #4
0
    // Use this for initialization
    private void Start()
    {
        if (!InitEnvironment())
        {
            DestroyEnvironment();
            return;
        }

        m_managers = new UNDictionary <Type, UNManager>();
        m_objMgr   = new ObjectManager();

        LoadModules();

        m_objMgr.AddEventListeners_();
    }
Beispiel #5
0
    public virtual void ChangeToState(UNBehaviorStateType state)
    {
        var oldState = m_curState;

        if (m_cbsBeforeChange != null)
        {
            for (int i = 0; i < m_cbsBeforeChange.Count; ++i)
            {
                m_cbsBeforeChange[i](m_type, oldState, state);
            }
        }
        m_stateCbs[state]();
        if (m_cbsAfterChange != null)
        {
            for (int i = 0; i < m_cbsAfterChange.Count; ++i)
            {
                m_cbsAfterChange[i](m_type, oldState, state);
            }
        }
    }
Beispiel #6
0
    // 初始化行为转换规则
    public void InitBehaviorsTrans()
    {
        var tableData = TableManager.Instance.GetEntry <ResBehaviorList>(m_ID) as ResBehavior;

        if (tableData.IsNull())
        {
            UNDebug.LogError("no this behavior " + m_ID);
            return;
        }
        if (m_behaviorsTransRules.IsNull())
        {
            m_behaviorsTransRules = UNDictionary <UNBehaviorType, UNList <UNBehaviorType> > .New();
        }
        for (int i = 0; i < tableData.trans.Count; ++i)
        {
            var data     = tableData.trans[i];
            var fromType = (UNBehaviorType)data.from;
            var toType   = (UNBehaviorType)data.to;
            AddBehaviorsTransRule(fromType, toType);
        }
    }
Beispiel #7
0
 public override void Init()
 {
     base.Init();
     Instance = this;
     m_objs   = UNDictionary <UNResourceObjectKey, UNList <UNResourceObject> > .New();
 }
Beispiel #8
0
 public override void Init()
 {
     Instance = this;
     m_objs   = new UNDictionary <Type, UNList <UNObject> >();
     base.Init();
 }
Beispiel #9
0
 public bool CanChangeToState(UNBehaviorStateType state)
 {
     return(m_stateCheckCbs[state]());
 }