Add Has Tag decorator

This commit is contained in:
Wojtek Figat
2023-08-25 10:42:53 +02:00
parent b31f262214
commit 99547a1ff4
4 changed files with 67 additions and 2 deletions

View File

@@ -8,6 +8,7 @@
#if USE_CSHARP
#include "Engine/Scripting/ManagedCLR/MClass.h"
#endif
#include "Engine/Level/Actor.h"
#include "Engine/Serialization/Serialization.h"
bool IsAssignableFrom(const StringAnsiView& to, const StringAnsiView& from)
@@ -445,3 +446,13 @@ bool BehaviorTreeKnowledgeValuesConditionalDecorator::CanUpdate(const BehaviorUp
{
return BehaviorKnowledge::CompareValues((float)ValueA.Get(context.Knowledge), (float)ValueB.Get(context.Knowledge), Comparison);
}
bool BehaviorTreeHasTagDecorator::CanUpdate(const BehaviorUpdateContext& context)
{
bool result = false;
::Actor* actor;
if (Actor.TryGet(context.Knowledge, actor) && actor)
result = actor->HasTag(Tag);
result ^= Invert;
return result;
}