34 lines
699 B
C++
34 lines
699 B
C++
#pragma once
|
|
|
|
#include "macros.h"
|
|
#include "scene/main/node.h"
|
|
|
|
class BehaviourNode : public Node {
|
|
GDCLASS(BehaviourNode, Node);
|
|
static void _bind_methods();
|
|
|
|
public:
|
|
GDENUM(Status, Fail, Running, Success);
|
|
|
|
protected:
|
|
void _notification(int what);
|
|
|
|
public:
|
|
virtual void enter() {}
|
|
virtual void execute() {}
|
|
virtual void exit() {}
|
|
virtual BehaviourNode *get_next() { return this; }
|
|
|
|
private:
|
|
class BehaviourTree *behaviour_tree{ nullptr };
|
|
BehaviourNode *parent{ nullptr };
|
|
Status status{};
|
|
bool leaf{ false };
|
|
|
|
public:
|
|
GET_SET_FNS(class BehaviourTree *, behaviour_tree);
|
|
GET_SET_FNS(Status, status);
|
|
GET_SET_FNS(bool, leaf);
|
|
};
|
|
|
|
MAKE_TYPE_INFO(BehaviourNode::Status, Variant::INT);
|