public HouseRangeDecorator(BtNode wrappedNode, BaseBlackboard bb, Villager villager, bool withinRange) : base(
         wrappedNode, bb)
 {
     WithinRange = withinRange;
     vBB         = (VillagerBB)bb;
     villagerRef = villager;
 }
Ejemplo n.º 2
0
 public virtual void RemoveChild(BtNode node)
 {
     if (m_children != null && node != null)
     {
         m_children.Remove(node);
     }
 }
Ejemplo n.º 3
0
    public override void RemoveChild(BtNode node)
    {
        int index = m_children.IndexOf(node);

        m_results.RemoveAt(index);
        base.RemoveChild(node);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 如果当前节点Tick结束,就继续下一个节点
    /// </summary>
    public override BtResult Tick()
    {
        if (m_curActiveChild == null)
        {
            m_curActiveChild = m_children[0];
            m_curActiveIndex = 0;
        }
        BtResult result = m_curActiveChild.Tick();

        if (result == BtResult.Ended)
        {
            m_curActiveIndex++;
            if (m_curActiveIndex >= m_children.Count)
            {
                m_curActiveChild.Clear();
                m_curActiveChild = null;
                m_curActiveIndex = -1;
            }
            else
            {
                m_curActiveChild.Clear();
                m_curActiveChild = m_children[m_curActiveIndex];
                result           = BtResult.Running;
            }
        }
        return(result);
    }
Ejemplo n.º 5
0
 public override void Clear()
 {
     if (m_curActiveChild != null)
     {
         m_curActiveChild.Clear();
         m_curActiveChild = null;
     }
 }
Ejemplo n.º 6
0
 public virtual void AddChild(BtNode node)
 {
     if (m_children == null)
     {
         m_children = new List <BtNode>();
     }
     if (node != null)
     {
         m_children.Add(node);
     }
 }
Ejemplo n.º 7
0
        public override void OnHeaderGUI()
        {
            GUI.color = Color.white;
            BtNode  node  = target as BtNode;
            BtGraph graph = node.graph as BtGraph;

            string title = target.name;

            GUILayout.Label(title, NodeEditorResources.styles.nodeHeader, GUILayout.Height(30));
            GUI.color = Color.white;
        }
Ejemplo n.º 8
0
 public override void Clear()
 {
     if (m_curActiveChild != null)
     {
         m_curActiveChild.Clear();
         m_curActiveChild = null;
         m_curActiveIndex = -1;
     }
     foreach (BtNode child in m_children)
     {
         child.Clear();
     }
 }
Ejemplo n.º 9
0
    /// <summary>
    /// 如果当前节点tick完成就清除
    /// </summary>
    public override BtResult Tick()
    {
        if (m_curActiveChild == null)
        {
            return(BtResult.Ended);
        }
        BtResult result = m_curActiveChild.Tick();

        if (result == BtResult.Ended)
        {
            m_curActiveChild.Clear();
            m_curActiveChild = null;
        }
        return(result);
    }
Ejemplo n.º 10
0
 /// <summary>
 /// 评估当前节点,如果没有就取第一个
 /// </summary>
 public override bool DoEvaluate()
 {
     if (m_curActiveChild != null)
     {
         // 评估不通过,清除当前节点
         bool result = m_curActiveChild.Evaluate();
         if (!result)
         {
             m_curActiveChild.Clear();
             m_curActiveChild = null;
             m_curActiveIndex = -1;
         }
         return(result);
     }
     else
     {
         return(m_children[0].Evaluate());
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 一般情况作为树的父节点,开始检查条件,满足后执行DoEvaluate,遍历子节点
 /// 遍历评估能通过的节点,设置为当前节点,然后tick
 /// </summary>
 public override bool DoEvaluate()
 {
     if (m_children != null)
     {
         foreach (BtNode child in m_children)
         {
             if (child.Evaluate())
             {
                 if (m_curActiveChild != null && m_curActiveChild != child)
                 {
                     m_curActiveChild.Clear();
                 }
                 m_curActiveChild = child;
                 return(true);
             }
         }
     }
     m_curActiveChild = null;
     return(false);
 }
Ejemplo n.º 12
0
 public override void AddChild(BtNode node)
 {
 }
Ejemplo n.º 13
0
 public FindTreeDecorator(BtNode wrappedNode, BaseBlackboard bb) : base(wrappedNode, bb)
 {
     vBB = (VillagerBB)bb;
 }
Ejemplo n.º 14
0
 public override void OnBodyGUI()
 {
     base.OnBodyGUI();
     BtNode  node  = target as BtNode;
     BtGraph graph = node.graph as BtGraph;
 }
Ejemplo n.º 15
0
 public override void AddChild(BtNode node)
 {
     base.AddChild(node);
     m_results.Add(BtResult.Running);
 }
Ejemplo n.º 16
0
 public CanRepairHomeDecorator(BtNode wrappedNode, BaseBlackboard bb, Villager villager) : base(wrappedNode,
                                                                                                bb)
 {
     vBB         = (VillagerBB)bb;
     villagerRef = villager;
 }
Ejemplo n.º 17
0
 public override void RemoveChild(BtNode node)
 {
 }