34 lines
689 B
C++
34 lines
689 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 check() const;
|
|
void ready();
|
|
void process(double delta);
|
|
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_distance{ 100.f };
|
|
float min_dot{ 0.1f };
|
|
double query_time{ 0.3 };
|
|
double query_timer{ 0.0 };
|
|
PhysicsDirectSpaceState3D::RayParameters ray_params{};
|
|
|
|
public:
|
|
static String sig_awareness_changed;
|
|
};
|
|
|
|
#endif // !PLAYER_DETECTOR_H
|