feat: added sound events for enemy awareness

This commit is contained in:
Sara 2025-08-04 17:00:23 +02:00
parent 1373656f90
commit 66aede32bd
15 changed files with 234 additions and 16 deletions

View file

@ -7,9 +7,11 @@
class PlayerDetector : public Node3D {
GDCLASS(PlayerDetector, Node3D);
static void _bind_methods();
bool line_of_sight_exists() const;
bool check() const;
void ready();
void process(double delta);
void on_player_sound(Vector3 at, float range);
void set_aware_of_player(bool value);
protected:
@ -20,10 +22,15 @@ public:
private:
bool aware_of_player{ false };
float max_distance{ 100.f };
float min_dot{ 0.1f };
float max_hearing_range{ 40.f };
float max_sight_range{ 100.f };
float min_sight_dot{ 0.1f };
double query_time{ 0.3 };
double query_timer{ 0.0 };
PhysicsDirectSpaceState3D::RayParameters ray_params{};
public: