tunnel-strategy/src/health.hpp

31 lines
593 B
C++

#ifndef HEALTH_HPP
#define HEALTH_HPP
#include <godot_cpp/classes/node.hpp>
namespace godot {
class Health : public Node {
GDCLASS(Health, Node);
static void _bind_methods();
public:
virtual void _enter_tree() override;
void damage(int amount);
void heal(int amount);
int get_health() const;
void set_max_health(int max_health);
int get_max_health() const;
private:
int health{1};
int max_health{1};
};
class IHealthEntity {
public:
virtual Health *get_health() = 0;
virtual Health const *get_health() const = 0;
};
}
#endif // !HEALTH_HPP