Skip to content

Commit

Permalink
Update audio Rolloff
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Oct 29, 2024
1 parent ffe66e4 commit a7aacee
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Fika.Core/Coop/Players/ObservedCoopPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ public override void OnDead(EDamageType damageType)
}
}
}
Singleton<BetterAudio>.Instance.ProtagonistHearingChanged -= UpdateStepSoundRolloff;
Singleton<BetterAudio>.Instance.ProtagonistHearingChanged -= UpdateSoundRolloff;
base.OnDead(damageType);
if (cullingHandler != null)
{
Expand Down Expand Up @@ -1271,7 +1271,18 @@ public override void ManualUpdate(float deltaTime, float? platformDeltaTime = nu
public override void InitAudioController()
{
base.InitAudioController();
Singleton<BetterAudio>.Instance.ProtagonistHearingChanged += UpdateStepSoundRolloff;
Singleton<BetterAudio>.Instance.ProtagonistHearingChanged += UpdateSoundRolloff;
}

private void UpdateSoundRolloff()
{
UpdateStepSoundRolloff();
UpdateVoiceSoundRolloff();
}

private void UpdateVoiceSoundRolloff()
{
SpeechSource?.SetRolloff(60f * ProtagonistHearing);
}

public override bool UpdateGrenadeAnimatorDuePoV()
Expand Down Expand Up @@ -1301,7 +1312,7 @@ public override void OnDestroy()
}
if (Singleton<BetterAudio>.Instantiated)
{
Singleton<BetterAudio>.Instance.ProtagonistHearingChanged -= UpdateStepSoundRolloff;
Singleton<BetterAudio>.Instance.ProtagonistHearingChanged -= UpdateSoundRolloff;
}
base.OnDestroy();
}
Expand Down

0 comments on commit a7aacee

Please sign in to comment.