public void AddThink(EThinkingType type) { if (!ContainsType(type)) { m_NeedThink.Add(type); } }
public bool CanDo(EThinkingType curtype) { if (m_NeedThink.Count == 0) { return(true); } return(m_NeedThink[m_NeedThink.Count - 1] == curtype); }
public bool RemoveThink(EThinkingType type) { if (ContainsType(type)) { return(m_NeedThink.Remove(type)); } return(false); }
//未开始的行为使用 public static bool CanDo(PeEntity entity, EThinkingType type) { NpcCmpt npc = entity.NpcCmpt; if (npc == null) { return(true); } return(npc.ThinkAgent.CanDo(type)); }
public bool hasthinkType(EThinkingType curtype) { for (int i = 0; i < m_NeedThink.Count; i++) { if (m_NeedThink[i] == curtype) { return(true); } } return(false); }
public bool ContainsType(EThinkingType type) { for (int i = 0; i < m_NeedThink.Count; i++) { if (m_NeedThink[i] == type) { return(true); } } return(false); }
//正在进行的行为使用 //返回值 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); }
public static NpcThinking Get(EThinkingType type) { return(_sThinking[type]); }
public EThinkingMask GetMask(EThinkingType type) { return(mThinkInfo[type]); }