public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { var @this = this; return(new VisualBuilder <EntitiesBT.Nodes.ParallelNode>(BuildImpl, Children.ToBuilderNode(instance, definition))); void BuildImpl(BlobBuilder blobBuilder, ref EntitiesBT.Nodes.ParallelNode data, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] builders) { } }
public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { var @this = this; return(new VisualBuilder <EntitiesBT.Nodes.RepeatForeverNode>(BuildImpl, Children.ToBuilderNode(instance, definition))); unsafe void BuildImpl(BlobBuilder blobBuilder, ref EntitiesBT.Nodes.RepeatForeverNode data, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] builders) { data.BreakStates = BreakStates; } } }
public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { var @this = this; return(new VisualBuilder <EntitiesBT.Nodes.TimerNode>(BuildImpl, Children.ToBuilderNode(instance, definition))); unsafe void BuildImpl(BlobBuilder blobBuilder, ref EntitiesBT.Nodes.TimerNode data, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] builders) { new DataPortReaderAndWriter(@this.IsLinkedCountdownSeconds, @this.InputCountdownSeconds, @this.OutputCountdownSeconds).ToVariantReaderAndWriter <System.Single>(instance, definition).Allocate(ref blobBuilder, ref data.CountdownSeconds, self, builders); data.BreakReturnState = BreakReturnState; } } }
public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { var @this = this; return(new VisualBuilder <TimerNode>(BuildImpl, Child.ToBuilderNode(instance, definition))); void BuildImpl(BlobBuilder blobBuilder, ref TimerNode data, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] builders) { data.BreakReturnState = @this.BreakReturnState; @this.CountdownSeconds.ToVariablePropertyReadWrite <float>(instance, definition) .Allocate(ref blobBuilder, ref data.CountdownSeconds, self, builders) ; } }
public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { var @this = this; return(new VisualBuilder <EntitiesBT.Nodes.StateMapNode>(BuildImpl, Children.ToBuilderNode(instance, definition))); void BuildImpl(BlobBuilder blobBuilder, ref EntitiesBT.Nodes.StateMapNode data, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] builders) { data.MapSuccess = MapSuccess; data.MapFailure = MapFailure; data.MapRunning = MapRunning; data.MapError = MapError; } }
public void Execute <TCtx>(TCtx ctx) where TCtx : IGraphInstance { var instance = ctx as GraphInstance; Assert.IsNotNull(instance); if (instance == null) { return; } var definition = ctx.GetGraphDefinition(); var builder = BehaviorTree.ToBuilderNode(instance, definition).Single(); var dstManager = ctx.EntityManager; var entity = dstManager.CreateEntity(); var blob = new NodeBlobRef(builder.ToBlob()); var bb = new EntityBlackboard { Entity = entity, EntityManager = dstManager }; VirtualMachine.Reset(ref blob, ref bb); var query = blob.GetAccessTypes(); var dataQuery = new BlackboardDataQuery(query, components => dstManager.CreateEntityQuery(components.ToArray())); dstManager.AddSharedComponentData(entity, dataQuery); dstManager.AddComponentData(entity, new BehaviorTreeComponent { Blob = blob, Thread = Thread, AutoCreation = AutoCreation }); dstManager.AddComponentObject(entity, new GraphInstanceComponent { Value = instance }); #if UNITY_EDITOR var debugName = ctx.ReadString(DebugName); if (!string.IsNullOrEmpty(debugName)) { dstManager.SetName(entity, debugName); } #endif ctx.Write(BehaviorTreeEntity, entity); }
public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { return(new VisualBuilder <RepeatForeverNode>(BuildImpl, Child.ToBuilderNode(instance, definition))); }
public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { var @this = this; return(new VisualBuilder <EntitiesBT.Nodes.WeightRandomSelectorNode>(BuildImpl, Children.ToBuilderNode(instance, definition))); unsafe void BuildImpl(BlobBuilder blobBuilder, ref EntitiesBT.Nodes.WeightRandomSelectorNode data, INodeDataBuilder self, ITreeNode <INodeDataBuilder>[] builders) { data.Sum = Sum; blobBuilder.AllocateArray(ref data.Weights, Weights); } } }
public INodeDataBuilder GetBuilder(GraphInstance instance, GraphDefinition definition) { return(new VisualBuilder <SelectorNode>(Children.ToBuilderNode(instance, definition))); }