/** * 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(); }
/** * 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(); }
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)); }
// ------------------------------------------------------------------- // 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; } } }
public Parallel(ParallelPolicy policy, params TaskId[] children) { this.SetPolicy(policy); this.Children = children.ToList(); }
public Parallel(ParallelPolicy policy, IEnumerable <TaskId> children) { this.SetPolicy(policy); this.Children = children.ToList(); }
// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public Parallel(ParallelPolicy policy = ParallelPolicy.Sequence) : this(policy, new TaskId[0]) { }
public override void Apply(object[] args) { this.policy = (ParallelPolicy)args[0]; }
public override void Apply(object[] args) { this.policy = (ParallelPolicy)args[0]; }
public BehaviourTreeParallelBuilder <TBlackboard, TFinalizeResult> WithSucceedPolicy(ParallelPolicy succeedPolicy) { _group.SucceedPolicy = succeedPolicy; return(this); }
public BehaviourTreeParallelBuilder <TBlackboard, TFinalizeResult> WithFailurePolicy(ParallelPolicy failurePolicy) { _group.FailurePolicy = failurePolicy; return(this); }
/** * 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) { }
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)); }
public ModelParallel(ModelTask guard, ParallelPolicy policy, string name, params ModelTask[] children) : base(guard, name, children) { this._policy = policy; }
/** * 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) { }
public ParallelNode(string name) : base(name) { FailurePolicy = ParallelPolicy.RequireOne; SucceedPolicy = ParallelPolicy.RequireAll; }
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; }
public ModelParallel(ModelTask guard, ParallelPolicy policy, string name, params ModelTask[] children) : base(guard, name, children) { this._policy = policy; }