예제 #1
0
    //获取记录,如果不存在返回null
    public static DBActorAiConf GetRecord(int actorID, bool errorMsg = true)
    {
        if (instance == null)
        {
            Debug.LogError("表DBActorAiTable未加载");
            return(null);
        }
        DBActorAiConf record = null;

        if (recordDict.TryGetValue(actorID, out record))
        {
            return(record);
        }
        if (errorMsg)
        {
            Debug.LogErrorFormat("表DBActorAiTable没有actorID = {0}的记录", actorID);
        }
        return(null);
    }
예제 #2
0
 public void Init()
 {
     //如果recordDict不为null,说明已经初始化了
     if (recordDict != null)
     {
         return;
     }
     recordDict = new Dictionary <int, DBActorAiConf>();
     for (int i = 0; i < recordArray.Length; i++)
     {
         DBActorAiConf record = recordArray[i];
         if (!recordDict.ContainsKey(record.actorID))
         {
             recordDict.Add(record.actorID, record);
         }
         else
         {
             Debug.LogErrorFormat("表DBActorAiTable有重复的记录,id = {0}", record.actorID);
         }
     }
 }
예제 #3
0
 public void StartAI(ActorBase actor)
 {
     this.actor = actor;
     aiConf     = DBActorAiTable.GetRecord(actor.actorConf.actorID);
     ChangeStatus(EmMyStatus.Idle);
 }