32 lines
		
	
	
		
			527 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			527 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef HEALTH_STATUS_H
 | 
						|
#define HEALTH_STATUS_H
 | 
						|
 | 
						|
#include "scene/main/node.h"
 | 
						|
 | 
						|
class HealthStatus : public Node {
 | 
						|
	GDCLASS(HealthStatus, Node);
 | 
						|
	static void _bind_methods();
 | 
						|
	void ready();
 | 
						|
 | 
						|
protected:
 | 
						|
	void _notification(int what);
 | 
						|
 | 
						|
public:
 | 
						|
	void set_health(int health);
 | 
						|
	int get_health() const;
 | 
						|
	int get_max_health() const;
 | 
						|
 | 
						|
	void damage(int amount);
 | 
						|
	void heal(int amount);
 | 
						|
 | 
						|
private:
 | 
						|
	int max_health{ 1 };
 | 
						|
	int health{ 1 };
 | 
						|
 | 
						|
public:
 | 
						|
	static String sig_death;
 | 
						|
	static String sig_health_changed;
 | 
						|
};
 | 
						|
 | 
						|
#endif // !HEALTH_STATUS_H
 |