Add Knowledge Conditional and Knowledge Values Conditional decorators to BT

This commit is contained in:
Wojtek Figat
2023-08-25 10:25:24 +02:00
parent cc7e93e2ee
commit b31f262214
6 changed files with 123 additions and 2 deletions

View File

@@ -435,3 +435,13 @@ void BehaviorTreeCooldownDecorator::PostUpdate(const BehaviorUpdateContext& cont
state->EndTime += context.Time;
}
}
bool BehaviorTreeKnowledgeConditionalDecorator::CanUpdate(const BehaviorUpdateContext& context)
{
return BehaviorKnowledge::CompareValues((float)ValueA.Get(context.Knowledge), ValueB, Comparison);
}
bool BehaviorTreeKnowledgeValuesConditionalDecorator::CanUpdate(const BehaviorUpdateContext& context)
{
return BehaviorKnowledge::CompareValues((float)ValueA.Get(context.Knowledge), (float)ValueB.Get(context.Knowledge), Comparison);
}