Exemple #1
0
        /// <summary>
        /// 创建一个装饰器:重复执行
        /// </summary>
        /// <param name="times"></param>
        /// <returns></returns>
        public YuAIBehaviorTreeBuilder Repeat(uint times = 0)
        {
            YuAIBehaviorBase behavior = new YuAIRepeat((int)times);

            AddBehavior(behavior);
            return(this);
        }
Exemple #2
0
        public void AddChildBehaviourNode(NodeType nodeType, object parme)
        {
            BehaviorTreeBaseNode behaviorNode = new BehaviorTreeBaseNode();

            switch (nodeType)
            {
            case NodeType.YuAIRepeat:
                int times = (int)parme;
                YuAIBehaviorBase behavior = new YuAIRepeat(times);
                behaviorNode.BindBehaviour(behavior);
                currentBehaviourNode.BindingBehaviour?.AddChild(behavior);
                break;

            case NodeType.Simple:
                var action = new UnitPatrolMoveAction();
                action.Init(parme);
                currentBehaviourNode?.BindingBehaviour?.AddChild(action);
                behaviorNode.BindBehaviour(action);
                break;
            }

            currentBehaviourNode.childNodes.Add(behaviorNode);
        }