示例#1
0
        /// <summary>
        /// Inserts a Condition into the Behavior Tree
        /// </summary>
        /// <param name="_name">Name describing the condition</param>
        /// <param name="_functionToExecute">Function that the condition will execute</param>
        /// <returns>Behavior Tree builder state</returns>
        public BehaviorTreeBuilder Condition(string _name, BehaviorTreeAction _functionToExecute)
        {
            if (parentNodeStack.Count < 0)
            {
                Debug.LogError($"[BEHAVIOR TREE BUILDER] Trying to insert Action Node where there is no available parent");
                return(this);
            }

            Condition conditionNode = new Condition(_name, _functionToExecute);

            parentNodeStack.Peek().AddChildBehavior(conditionNode);
            return(this);
        }
示例#2
0
 public Action(string _nodeName, BehaviorTreeAction _nodeBehavior) : base(_nodeName)
 {
     m_nodeBehavior = _nodeBehavior;
 }