Add relevancy to Behavior Tree nodes

This commit is contained in:
Wojtek Figat
2023-08-17 21:24:19 +02:00
parent 14ffd0aa08
commit 1e3e75cb99
6 changed files with 90 additions and 37 deletions

View File

@@ -12,10 +12,13 @@ API_CLASS(Abstract) class FLAXENGINE_API BehaviorTreeNode : public SerializableS
{
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(BehaviorTreeNode, SerializableScriptingObject);
friend class BehaviorTreeGraph;
friend class BehaviorKnowledge;
protected:
// Raw memory byte offset from the start of the behavior memory block.
API_FIELD(ReadOnly) int32 _memoryOffset = 0;
// Execution index of the node within tree.
API_FIELD(ReadOnly) int32 _executionIndex = -1;
public:
/// <summary>
@@ -67,6 +70,9 @@ public:
return BehaviorUpdateResult::Success;
}
// Helper utility to update node with state creation/cleanup depending on node relevancy.
BehaviorUpdateResult InvokeUpdate(const BehaviorUpdateContext& context);
// [SerializableScriptingObject]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;