BTDecorator: Add default `_tick` implementation

The default implementation simply ticks the child task and returns its status.
This commit is contained in:
Serhii Snitsaruk 2024-04-22 11:07:11 +02:00
parent af0250dc60
commit e1c8ce4a58
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
2 changed files with 8 additions and 0 deletions

View File

@ -18,3 +18,8 @@ PackedStringArray BTDecorator::get_configuration_warnings() {
}
return warnings;
}
BT::Status BTDecorator::_tick(double p_delta) {
ERR_FAIL_COND_V_MSG(get_child_count() == 0, FAILURE, "BT decorator doesn't have a child.");
return get_child(0)->execute(p_delta);
}

View File

@ -17,6 +17,9 @@
class BTDecorator : public BTTask {
GDCLASS(BTDecorator, BTTask)
protected:
virtual Status _tick(double p_delta) override;
public:
virtual PackedStringArray get_configuration_warnings() override;
};