2022-10-19 18:54:21 +00:00
|
|
|
/* bt_state.h */
|
|
|
|
|
|
|
|
#ifndef BT_STATE_H
|
|
|
|
#define BT_STATE_H
|
|
|
|
|
|
|
|
#include "core/object.h"
|
|
|
|
#include "modules/limboai/bt/behavior_tree.h"
|
|
|
|
#include "modules/limboai/bt/bt_task.h"
|
|
|
|
#include "modules/limboai/limbo_state.h"
|
|
|
|
|
|
|
|
class BTState : public LimboState {
|
|
|
|
GDCLASS(BTState, LimboState);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ref<BehaviorTree> behavior_tree;
|
|
|
|
Ref<BTTask> root_task;
|
2022-11-04 12:26:49 +00:00
|
|
|
String success_event;
|
|
|
|
String failure_event;
|
2022-10-19 18:54:21 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
virtual void _setup();
|
2022-10-19 21:41:56 +00:00
|
|
|
virtual void _enter() {}
|
2022-10-19 18:54:21 +00:00
|
|
|
virtual void _exit();
|
|
|
|
virtual void _update(float p_delta);
|
|
|
|
|
|
|
|
public:
|
|
|
|
void set_behavior_tree(const Ref<BehaviorTree> &p_value) { behavior_tree = p_value; }
|
|
|
|
Ref<BehaviorTree> get_behavior_tree() const { return behavior_tree; }
|
2022-10-19 21:41:56 +00:00
|
|
|
|
2022-11-04 12:26:49 +00:00
|
|
|
void set_success_event(String p_success_event) { success_event = p_success_event; }
|
|
|
|
String get_success_event() const { return success_event; }
|
|
|
|
|
|
|
|
void set_failure_event(String p_failure_event) { failure_event = p_failure_event; }
|
|
|
|
String get_failure_event() const { return failure_event; }
|
|
|
|
|
2022-10-19 21:41:56 +00:00
|
|
|
BTState();
|
2022-10-19 18:54:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BT_STATE_H
|