BTDecorator: Add default `_tick` implementation
The default implementation simply ticks the child task and returns its status.
This commit is contained in:
parent
af0250dc60
commit
e1c8ce4a58
|
@ -18,3 +18,8 @@ PackedStringArray BTDecorator::get_configuration_warnings() {
|
||||||
}
|
}
|
||||||
return 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);
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
class BTDecorator : public BTTask {
|
class BTDecorator : public BTTask {
|
||||||
GDCLASS(BTDecorator, BTTask)
|
GDCLASS(BTDecorator, BTTask)
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual Status _tick(double p_delta) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual PackedStringArray get_configuration_warnings() override;
|
virtual PackedStringArray get_configuration_warnings() override;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue