public BehaviorTreeBufferElement(int order, BehaviorTreeRuntimeThread runtimeThread, NodeBlobRef nodeBlob, EntityQueryMask queryMask, Entity behaviorTree, JobHandle dependency) { Order = order; RuntimeThread = runtimeThread; NodeBlob = nodeBlob; QueryMask = queryMask; BehaviorTree = behaviorTree; Dependency = dependency; }
// TODO: sync-points optimization? protected override void OnUpdate() { // create Entities .WithoutBurst() .WithStructuralChanges() .WithNone <LastTargetComponent>() .ForEach((Entity entity, in BlackboardDataQuery query, in BehaviorTreeComponent bt, in BehaviorTreeTargetComponent target, in BehaviorTreeOrderComponent order) => { var blob = new NodeBlobRef(bt.Blob.BlobRef.Clone()); EntityManager.AddComponentData(entity, new LastTargetComponent { Target = target.Value, Blob = blob }); BindBehaviorTree(entity, bt, query, target.Value, order.Value, blob); }).Run();
protected override void OnUpdate() { var ecb = _entityCommandBufferSystem.CreateCommandBuffer(); // create Entities .WithoutBurst() .WithNone <LastTargetComponent>() .ForEach((Entity entity, in BlackboardDataQuery query, in BehaviorTreeComponent bt, in BehaviorTreeTargetComponent target, in BehaviorTreeOrderComponent order) => { var blob = new NodeBlobRef(bt.Blob.BlobRef.Clone()); ecb.AddComponent(entity, new LastTargetComponent { Target = target.Value, Blob = blob }); BindBehaviorTree(ecb, entity, bt, query, target.Value, order.Value, blob); }).Run();
public BehaviorTreeComponent(NodeBlobRef blob, BehaviorTreeThread thread, AutoCreateType autoCreation) { Blob = blob; Thread = thread; AutoCreation = autoCreation; }