28 lines
528 B
C++
28 lines
528 B
C++
#ifndef DAMAGE_BOX_H
|
|
#define DAMAGE_BOX_H
|
|
|
|
#include "core/templates/hash_set.h"
|
|
#include "scene/3d/physics/area_3d.h"
|
|
class HealthStatus;
|
|
|
|
class DamageBox : public Area3D {
|
|
GDCLASS(DamageBox, Area3D);
|
|
static void _bind_methods();
|
|
void attack_motion_begin();
|
|
void attack_motion_end();
|
|
void on_body_entered(Node3D *body);
|
|
|
|
protected:
|
|
void _notification(int what);
|
|
|
|
public:
|
|
void set_damage(int amount);
|
|
int get_damage() const;
|
|
|
|
private:
|
|
int damage{ 1 };
|
|
HashSet<HealthStatus *> already_hit{};
|
|
};
|
|
|
|
#endif // !DAMAGE_BOX_H
|