feat: added delay to detecting the player

This commit is contained in:
Sara 2025-08-30 13:14:23 +02:00
parent f646f70c37
commit 6456d81794
2 changed files with 6 additions and 3 deletions

View file

@ -46,7 +46,8 @@ void PlayerDetector::process(double delta) {
} else {
this->query_timer = this->query_time;
bool const new_awareness{ check() };
if (new_awareness != this->aware_of_player) {
this->awareness = CLAMP(this->awareness + (new_awareness ? this->awareness_increments : -this->awareness_increments), 0.0, 1.0);
if (this->awareness >= 1.0) {
set_aware_of_player(new_awareness);
}
}

View file

@ -23,13 +23,15 @@ public:
private:
bool aware_of_player{ false };
float max_hearing_range{ 40.f };
float max_hearing_range{ 100.f };
float max_sight_range{ 20.f };
float max_sight_range{ 60.f };
float min_sight_dot{ 0.7f };
double query_time{ 0.3 };
double query_timer{ 0.0 };
double awareness{ 0.0 };
double awareness_increments{ 0.4 };
PhysicsDirectSpaceState3D::RayParameters ray_params{};