Ejemplo n.º 1
0
 public void AddThink(EThinkingType type)
 {
     if (!ContainsType(type))
     {
         m_NeedThink.Add(type);
     }
 }
Ejemplo n.º 2
0
        public bool CanDo(EThinkingType curtype)
        {
            if (m_NeedThink.Count == 0)
            {
                return(true);
            }

            return(m_NeedThink[m_NeedThink.Count - 1] == curtype);
        }
Ejemplo n.º 3
0
        public bool RemoveThink(EThinkingType type)
        {
            if (ContainsType(type))
            {
                return(m_NeedThink.Remove(type));
            }

            return(false);
        }
Ejemplo n.º 4
0
        //未开始的行为使用
        public static bool CanDo(PeEntity entity, EThinkingType type)
        {
            NpcCmpt npc = entity.NpcCmpt;

            if (npc == null)
            {
                return(true);
            }

            return(npc.ThinkAgent.CanDo(type));
        }
Ejemplo n.º 5
0
 public bool hasthinkType(EThinkingType curtype)
 {
     for (int i = 0; i < m_NeedThink.Count; i++)
     {
         if (m_NeedThink[i] == curtype)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 6
0
 public bool ContainsType(EThinkingType type)
 {
     for (int i = 0; i < m_NeedThink.Count; i++)
     {
         if (m_NeedThink[i] == type)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
        //正在进行的行为使用
        //返回值 Ture 当前type可以执行
        public static bool CanDoing(PeEntity entity, EThinkingType _newtThink)
        {
            NpcCmpt npc = entity.NpcCmpt;

            if (npc == null)
            {
                return(true);
            }

            if (!npc.ThinkAgent.CanDo(_newtThink))
            {
                EThinkingType _curThinkType = npc.ThinkAgent.GetNowDo();
                //NpcThinking curthink = Get(_curThinkType);
                NpcThinking newthink = Get(_newtThink);

                //1:阻塞当前行为,执行新加入行为
                if (newthink.GetMask(_curThinkType) == EThinkingMask.Block)
                {
                    npc.ThinkAgent.RemoveThink(_curThinkType);
                    npc.ThinkAgent.RemoveThink(_newtThink);

                    npc.ThinkAgent.AddThink(_curThinkType);
                    npc.ThinkAgent.AddThink(_newtThink);
                    return(true);
                }

                //-1:阻塞新加入行为,执行当前行为
                if (newthink.GetMask(_curThinkType) == EThinkingMask.Blocked)
                {
                    npc.ThinkAgent.RemoveThink(_newtThink);
                    npc.ThinkAgent.RemoveThink(_curThinkType);

                    npc.ThinkAgent.AddThink(_newtThink);
                    npc.ThinkAgent.AddThink(_curThinkType);
                    return(false);
                }

                //接受新的行为,删除当前行为
                if (newthink.GetMask(_curThinkType) == EThinkingMask.Delete)
                {
                    npc.ThinkAgent.RemoveThink(_curThinkType);
                    npc.ThinkAgent.AddThink(_newtThink);
                    return(true);
                }
                //不接收新的
                if (newthink.GetMask(_curThinkType) == EThinkingMask.Deleted)
                {
                    //no noth
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 8
0
 public static NpcThinking Get(EThinkingType type)
 {
     return(_sThinking[type]);
 }
Ejemplo n.º 9
0
 public EThinkingMask GetMask(EThinkingType type)
 {
     return(mThinkInfo[type]);
 }