#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 execute() {} virtual void enter() { set_status(Fail); } virtual void exit() {} virtual BehaviourNode *get_next() { return this; } private: class BehaviourTree *behaviour_tree{ nullptr }; BehaviourNode *parent{ nullptr }; Status status{ Fail }; 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);