2023-07-21 09:50:06 +00:00
|
|
|
/**
|
|
|
|
* behavior_tree_data.h
|
|
|
|
* =============================================================================
|
2024-03-21 20:38:57 +00:00
|
|
|
* Copyright 2021-2024 Serhii Snitsaruk
|
2023-07-21 09:50:06 +00:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style
|
|
|
|
* license that can be found in the LICENSE file or at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
|
|
|
* =============================================================================
|
|
|
|
*/
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
#ifndef BEHAVIOR_TREE_DATA_H
|
|
|
|
#define BEHAVIOR_TREE_DATA_H
|
|
|
|
|
2024-08-03 09:07:06 +00:00
|
|
|
#include "../../bt/bt_instance.h"
|
2024-01-07 01:40:51 +00:00
|
|
|
#include "../../bt/tasks/bt_task.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
|
2024-02-03 15:31:21 +00:00
|
|
|
class BehaviorTreeData : public RefCounted {
|
|
|
|
GDCLASS(BehaviorTreeData, RefCounted);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2023-04-13 07:29:45 +00:00
|
|
|
public:
|
|
|
|
struct TaskData {
|
2024-02-17 10:42:48 +00:00
|
|
|
uint64_t id = 0;
|
2023-04-13 07:29:45 +00:00
|
|
|
String name;
|
2023-08-29 08:45:00 +00:00
|
|
|
bool is_custom_name = false;
|
2023-04-13 07:29:45 +00:00
|
|
|
int num_children = 0;
|
|
|
|
int status = 0;
|
2023-04-14 08:16:26 +00:00
|
|
|
double elapsed_time = 0.0;
|
2023-04-13 07:29:45 +00:00
|
|
|
String type_name;
|
2023-04-16 06:26:47 +00:00
|
|
|
String script_path;
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2024-02-17 10:42:48 +00:00
|
|
|
TaskData(uint64_t p_id, const String &p_name, bool p_is_custom_name, int p_num_children, int p_status, double p_elapsed_time, const String &p_type_name, const String &p_script_path) {
|
2023-04-14 08:16:26 +00:00
|
|
|
id = p_id;
|
2023-04-13 07:29:45 +00:00
|
|
|
name = p_name;
|
2023-08-29 08:45:00 +00:00
|
|
|
is_custom_name = p_is_custom_name;
|
2023-04-13 07:29:45 +00:00
|
|
|
num_children = p_num_children;
|
|
|
|
status = p_status;
|
2023-04-14 08:16:26 +00:00
|
|
|
elapsed_time = p_elapsed_time;
|
2023-04-13 07:29:45 +00:00
|
|
|
type_name = p_type_name;
|
2023-04-16 06:26:47 +00:00
|
|
|
script_path = p_script_path;
|
2023-04-13 07:29:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TaskData() {}
|
|
|
|
};
|
|
|
|
|
|
|
|
List<TaskData> tasks;
|
2024-08-03 09:07:06 +00:00
|
|
|
uint64_t bt_instance_id;
|
|
|
|
NodePath node_owner_path;
|
|
|
|
String source_bt_path;
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2024-02-03 15:31:21 +00:00
|
|
|
public:
|
2024-08-03 09:07:06 +00:00
|
|
|
static Array serialize(const Ref<BTInstance> &p_instance);
|
2024-02-03 15:31:21 +00:00
|
|
|
static Ref<BehaviorTreeData> deserialize(const Array &p_array);
|
2024-08-03 09:07:06 +00:00
|
|
|
static Ref<BehaviorTreeData> create_from_bt_instance(const Ref<BTInstance> &p_bt_instance);
|
2023-04-13 07:29:45 +00:00
|
|
|
|
2024-02-03 15:31:21 +00:00
|
|
|
BehaviorTreeData();
|
2023-04-13 07:29:45 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // BEHAVIOR_TREE_DATA_H
|