コード例 #1
0
        /**
         * Creates an ExecutionParallel that is able to run a ModelParallel task and
         * that is managed by a BTExecutor.
         *
         * @param modelTask
         *            the ModelParallel that this ExecutionParallel is going to run.
         * @param executor
         *            the BTExecutor in charge of running this ExecutionParallel.
         * @param parent
         *            the parent ExecutionTask of this task.
         */

        public ExecutionParallel(ModelTask modelTask, BTExecutor executor, ExecutionTask parent)
            : base(modelTask, executor, parent)
        {
            if (!(modelTask is ModelParallel))
            {
                throw new ArgumentException("The ModelTask must subclass " + typeof(ModelParallel).Name + " but it inherits from " +
                                            modelTask.GetType().Name);
            }

            _policy        = ((ModelParallel)modelTask).Policy;
            _modelChildren = modelTask.Children;
            Initialize();
        }
コード例 #2
0
        /**
         * Creates an ExecutionParallel that is able to run a ModelParallel task and
         * that is managed by a BTExecutor.
         *
         * @param modelTask
         *            the ModelParallel that this ExecutionParallel is going to run.
         * @param executor
         *            the BTExecutor in charge of running this ExecutionParallel.
         * @param parent
         *            the parent ExecutionTask of this task.
         */
        public ExecutionParallel(ModelTask modelTask, BTExecutor executor, ExecutionTask parent)
            : base(modelTask, executor, parent)
        {
            if (!(modelTask is ModelParallel))
            {
                throw new ArgumentException("The ModelTask must subclass " + typeof (ModelParallel).Name + " but it inherits from " +
                                            modelTask.GetType().Name);
            }

            _policy = ((ModelParallel)modelTask).Policy;
            _modelChildren = modelTask.Children;
            Initialize();
        }
コード例 #3
0
        public SimpleBehaviourTreeBuilder <TBlackboard> Parallel(string name,
                                                                 ParallelPolicy failurePolicy = ParallelPolicy.RequireOne,
                                                                 ParallelPolicy succeedPolicy = ParallelPolicy.RequireAll)
        {
            var node = new ParallelNode <TBlackboard>(name)
            {
                FailurePolicy = failurePolicy,
                SucceedPolicy = succeedPolicy
            };

            AcceptNode(node);
            return(new SimpleBehaviourTreeBuilder <TBlackboard>(this, _node));
        }
コード例 #4
0
ファイル: Parallel.cs プロジェクト: Craiel/GDX.AI.Sharp
        // -------------------------------------------------------------------
        // Private
        // -------------------------------------------------------------------
        private void SetPolicy(ParallelPolicy policy)
        {
            this.Policy = policy;
            switch (policy)
            {
            case ParallelPolicy.Selector:
            {
                this.policyImplementation = new PolicySelector();
                break;
            }

            case ParallelPolicy.Sequence:
            {
                this.policyImplementation = new PolicySequence();
                break;
            }
            }
        }
コード例 #5
0
ファイル: Parallel.cs プロジェクト: Craiel/GDX.AI.Sharp
 public Parallel(ParallelPolicy policy, params TaskId[] children)
 {
     this.SetPolicy(policy);
     this.Children = children.ToList();
 }
コード例 #6
0
ファイル: Parallel.cs プロジェクト: Craiel/GDX.AI.Sharp
 public Parallel(ParallelPolicy policy, IEnumerable <TaskId> children)
 {
     this.SetPolicy(policy);
     this.Children = children.ToList();
 }
コード例 #7
0
ファイル: Parallel.cs プロジェクト: Craiel/GDX.AI.Sharp
 // -------------------------------------------------------------------
 // Constructor
 // -------------------------------------------------------------------
 public Parallel(ParallelPolicy policy = ParallelPolicy.Sequence)
     : this(policy, new TaskId[0])
 {
 }
コード例 #8
0
 public override void Apply(object[] args)
 {
     this.policy = (ParallelPolicy)args[0];
 }
コード例 #9
0
ファイル: Parallel.cs プロジェクト: simonwittber/uBAD
 public override void Apply(object[] args)
 {
     this.policy = (ParallelPolicy)args[0];
 }
コード例 #10
0
 public BehaviourTreeParallelBuilder <TBlackboard, TFinalizeResult> WithSucceedPolicy(ParallelPolicy succeedPolicy)
 {
     _group.SucceedPolicy = succeedPolicy;
     return(this);
 }
コード例 #11
0
 public BehaviourTreeParallelBuilder <TBlackboard, TFinalizeResult> WithFailurePolicy(ParallelPolicy failurePolicy)
 {
     _group.FailurePolicy = failurePolicy;
     return(this);
 }
コード例 #12
0
 /**
  * Creates a ModelParallel task with a guard, a policy and a list of
  * children to run. A ModelParallel must have at least one child.
  *
  * @param guard
  *            the guard, which may be null.
  * @param policy
  *            the policy for the ModelParallel.
  * @param children
  *            the list of children. Must have at least one element.
  */
 public ModelParallel(ModelTask guard, ParallelPolicy policy, params ModelTask[] children)
     : this(guard, policy, null, children)
 {
 }
コード例 #13
0
        public BehaviourTreeParallelBuilder <TBlackboard, TBuilderMethodResult> Parallel(string name,
                                                                                         ParallelPolicy failurePolicy = ParallelPolicy.RequireOne,
                                                                                         ParallelPolicy succeedPolicy = ParallelPolicy.RequireAll)
        {
            var node = new ParallelNode <TBlackboard>(name)
            {
                FailurePolicy = failurePolicy,
                SucceedPolicy = succeedPolicy
            };

            AcceptNode(node);
            return(new BehaviourTreeParallelBuilder <TBlackboard, TBuilderMethodResult>(GetBuilderMethodResult(), node));
        }
コード例 #14
0
 public ModelParallel(ModelTask guard, ParallelPolicy policy, string name, params ModelTask[] children)
     : base(guard, name, children)
 {
     this._policy = policy;
 }
コード例 #15
0
 /**
  * Creates a ModelParallel task with a guard, a policy and a list of
  * children to run. A ModelParallel must have at least one child.
  *
  * @param guard
  *            the guard, which may be null.
  * @param policy
  *            the policy for the ModelParallel.
  * @param children
  *            the list of children. Must have at least one element.
  */
 public ModelParallel(ModelTask guard, ParallelPolicy policy, params ModelTask[] children)
     : this(guard, policy, null, children)
 {
 }
コード例 #16
0
 public ParallelNode(string name) : base(name)
 {
     FailurePolicy = ParallelPolicy.RequireOne;
     SucceedPolicy = ParallelPolicy.RequireAll;
 }
コード例 #17
0
        public override bool LoadProtoBuf(BehaviorPB.Node node)
        {
            if (!base.LoadProtoBuf(node))
                return false;

            if (node.parallel == null)
                return false;

            policy = node.parallel.policy;
            return true;
        }
コード例 #18
0
 public ModelParallel(ModelTask guard, ParallelPolicy policy, string name, params ModelTask[] children)
     : base(guard, name, children)
 {
     this._policy = policy;
 }