exponentiaL

This commit is contained in:
AmadeusWM
2025-04-06 23:32:46 +02:00
parent e5fc52e3b9
commit 79f69c4383

View File

@@ -157,7 +157,7 @@ fn update_monster_state(
MonsterState::Dormant => Timer::from_seconds(15.0, TimerMode::Once), MonsterState::Dormant => Timer::from_seconds(15.0, TimerMode::Once),
MonsterState::Lurking => Timer::from_seconds(20.0, TimerMode::Once), MonsterState::Lurking => Timer::from_seconds(20.0, TimerMode::Once),
MonsterState::Wandering => Timer::from_seconds(30.0, TimerMode::Once), MonsterState::Wandering => Timer::from_seconds(30.0, TimerMode::Once),
MonsterState::Hunting => Timer::from_seconds(15.0, TimerMode::Once), MonsterState::Hunting => Timer::from_seconds(20.0, TimerMode::Once),
}; };
// reset pathfinding when state changes // reset pathfinding when state changes
@@ -346,7 +346,7 @@ fn play_footstep_segment(
}; };
// adjust volume based on distance (closer = louder) // adjust volume based on distance (closer = louder)
let distance_factor: f32 = (1.0 - distance / 30.0).clamp(0.0, 1.0); let distance_factor: f32 = (1.0 - (distance / 30.0).powf(2.0)).clamp(0.0, 1.0);
let volume = base_volume * distance_factor; let volume = base_volume * distance_factor;
// play only a short segment of the footstep sound // play only a short segment of the footstep sound