wave-survival/modules/wave_survival/interactable.h

31 lines
809 B
C++

#ifndef INTERACTABLE_H
#define INTERACTABLE_H
#include "player_interactor.h"
#include "scene/main/node.h"
class Interactable : public Node {
GDCLASS(Interactable, Node);
static void _bind_methods();
protected:
virtual void activated(PlayerInteractor *interactor) {}
GDVIRTUAL1_REQUIRED(_activated, PlayerInteractor *);
virtual void highlight_changed(PlayerInteractor *interactor, bool new_value) {}
GDVIRTUAL2(_highlight_changed, PlayerInteractor *, bool);
public:
void activate(PlayerInteractor *interactor);
void set_highlighted(PlayerInteractor *interactor, bool value);
bool get_highlighted() const;
void set_highlight_tooltip(String value);
String get_highlight_tooltip() const;
private:
bool highlighted{ false };
String highlight_tooltip{ "Activate" };
};
#endif // !INTERACTABLE_H