2022-08-29 12:06:48 +00:00
|
|
|
/* bt_wait_ticks.cpp */
|
|
|
|
|
|
|
|
#include "bt_wait_ticks.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
|
2022-12-15 07:26:52 +00:00
|
|
|
#include "core/object/class_db.h"
|
|
|
|
#include "core/object/object.h"
|
|
|
|
#include "core/variant/variant.h"
|
2022-08-29 12:06:48 +00:00
|
|
|
|
|
|
|
String BTWaitTicks::_generate_name() const {
|
|
|
|
return vformat("WaitTicks x%d", num_ticks);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BTWaitTicks::_enter() {
|
2022-12-17 10:26:48 +00:00
|
|
|
num_passed = 0;
|
2022-08-29 12:06:48 +00:00
|
|
|
}
|
|
|
|
|
2023-04-10 08:08:11 +00:00
|
|
|
int BTWaitTicks::_tick(double p_delta) {
|
2022-12-17 10:26:48 +00:00
|
|
|
num_passed += 1;
|
|
|
|
if (num_passed < num_ticks) {
|
2022-08-29 12:06:48 +00:00
|
|
|
return RUNNING;
|
|
|
|
} else {
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BTWaitTicks::_bind_methods() {
|
|
|
|
ClassDB::bind_method(D_METHOD("set_num_ticks", "p_value"), &BTWaitTicks::set_num_ticks);
|
|
|
|
ClassDB::bind_method(D_METHOD("get_num_ticks"), &BTWaitTicks::get_num_ticks);
|
|
|
|
|
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::INT, "num_ticks"), "set_num_ticks", "get_num_ticks");
|
|
|
|
}
|