2022-08-30 16:48:49 +00:00
|
|
|
/* behavior_tree.h */
|
|
|
|
|
|
|
|
#ifndef BEHAVIOR_TREE_H
|
|
|
|
#define BEHAVIOR_TREE_H
|
|
|
|
|
2022-09-21 14:13:17 +00:00
|
|
|
#include "bt_task.h"
|
2022-12-15 07:26:52 +00:00
|
|
|
#include "core/io/resource.h"
|
|
|
|
#include "core/object/object.h"
|
2022-09-21 14:13:17 +00:00
|
|
|
#include "modules/limboai/blackboard.h"
|
2022-08-30 16:48:49 +00:00
|
|
|
|
|
|
|
class BehaviorTree : public Resource {
|
|
|
|
GDCLASS(BehaviorTree, Resource);
|
|
|
|
|
|
|
|
private:
|
|
|
|
String description;
|
|
|
|
Ref<BTTask> root_task;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2022-12-19 09:29:46 +00:00
|
|
|
virtual bool editor_can_reload_from_file() override { return false; }
|
|
|
|
|
2022-08-30 16:48:49 +00:00
|
|
|
void set_description(String p_value) {
|
|
|
|
description = p_value;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
String get_description() const { return description; }
|
|
|
|
|
|
|
|
void set_root_task(const Ref<BTTask> &p_value) {
|
|
|
|
root_task = p_value;
|
|
|
|
emit_changed();
|
|
|
|
}
|
|
|
|
Ref<BTTask> get_root_task() const { return root_task; }
|
|
|
|
|
2022-12-16 13:29:14 +00:00
|
|
|
// void init();
|
2022-08-30 16:48:49 +00:00
|
|
|
Ref<BehaviorTree> clone() const;
|
2022-12-16 13:29:14 +00:00
|
|
|
Ref<BTTask> instantiate(Node *p_agent, const Ref<Blackboard> &p_blackboard) const;
|
2022-08-30 16:48:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BEHAVIOR_TREE_H
|