MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ReleaseState

Method ReleaseState

Source/Engine/AI/BehaviorTreeNodes.cpp:307–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307void BehaviorTreeSubTreeNode::ReleaseState(const BehaviorUpdateContext& context)
308{
309 auto state = GetState<State>(context.Memory);
310 const BehaviorTree* tree = Tree.Get();
311 if (tree && tree->IsLoaded())
312 {
313 // Override memory with custom one for the subtree
314 BehaviorUpdateContext subContext = context;
315 subContext.Memory = state->Memory.Get();
316 subContext.RelevantNodes = &state->RelevantNodes;
317
318 for (const auto& node : tree->Graph.Nodes)
319 {
320 if (node.Instance && node.Instance->_executionIndex != -1 && state->RelevantNodes.HasItems() && state->RelevantNodes[node.Instance->_executionIndex])
321 node.Instance->ReleaseState(subContext);
322 }
323 }
324 state->~State();
325}
326
327BehaviorUpdateResult BehaviorTreeSubTreeNode::Update(const BehaviorUpdateContext& context)
328{

Callers 1

FreeMemoryMethod · 0.80

Calls 5

~StateMethod · 0.80
GetMethod · 0.45
IsLoadedMethod · 0.45
HasItemsMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected