41 lines
819 B
C++
41 lines
819 B
C++
#ifndef PLAYER_DETECTOR_H
|
|
#define PLAYER_DETECTOR_H
|
|
|
|
#include "player_body.h"
|
|
#include "scene/3d/node_3d.h"
|
|
|
|
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:
|
|
void _notification(int what);
|
|
|
|
public:
|
|
bool is_aware_of_player() const;
|
|
|
|
private:
|
|
bool aware_of_player{ false };
|
|
|
|
float max_hearing_range{ 40.f };
|
|
|
|
float max_sight_range{ 20.f };
|
|
float min_sight_dot{ 0.7f };
|
|
|
|
double query_time{ 0.3 };
|
|
double query_timer{ 0.0 };
|
|
|
|
PhysicsDirectSpaceState3D::RayParameters ray_params{};
|
|
|
|
public:
|
|
static String sig_awareness_changed;
|
|
};
|
|
|
|
#endif // !PLAYER_DETECTOR_H
|