// Reload public void OnReload(WeaponAudioInfo audioInfo) { WeaponReload.outputAudioMixerGroup = audioInfo.ReloadMixerGroup; audioInfo.ReloadLastUniqiueIndex = F3DAudio.GetUniqueRandomClipIndex(audioInfo.Reload.Length, audioInfo.ReloadLastUniqiueIndex); F3DAudio.PlayOneShotRandom(WeaponReload, audioInfo.Reload[audioInfo.ReloadLastUniqiueIndex], audioInfo.ReloadVolume, audioInfo.ReloadPitch); }
// Land public void OnLand() { var state = CharacterState.Land; var surfaceClips = GetSurfaceClips(state); _lastFootstepsLandIndex = F3DAudio.GetUniqueRandomClipIndex(surfaceClips.Length, _lastFootstepsLandIndex); F3DAudio.PlayOneShotRandom(FootstepsLand, surfaceClips[_lastFootstepsLandIndex], GetSurfaceVolume(state), GetSurfacePitch(state)); }
// Animation EVENT: Crouch public void OnCrouchMoveAnimation() { var state = CharacterState.Crouch; var surfaceClips = GetSurfaceClips(state); _lastFootstepsCrouchIndex = F3DAudio.GetUniqueRandomClipIndex(surfaceClips.Length, _lastFootstepsCrouchIndex); F3DAudio.PlayOneShotRandom(Footsteps, surfaceClips[_lastFootstepsCrouchIndex], GetSurfaceVolume(state), GetSurfacePitch(state)); }
// Double Jump public void OnDoubleJump() { OnJump(); var state = CharacterState.DoubleJump; var surfaceClips = GetSurfaceClips(state); _lastFootstepsDoubleJumpIndex = F3DAudio.GetUniqueRandomClipIndex(surfaceClips.Length, _lastFootstepsDoubleJumpIndex); F3DAudio.PlayOneShotRandom(FootstepsJump, surfaceClips[_lastFootstepsDoubleJumpIndex], GetSurfaceVolume(state), GetSurfacePitch(state)); }
// WEAPON // Fire single round public void OnFire(WeaponAudioInfo audioInfo) { if (audioInfo.Shot == null || audioInfo.Shot.Length < 1) { return; } Weapon.outputAudioMixerGroup = audioInfo.MixerGroup; audioInfo.ShotLastUniqiueIndex = F3DAudio.GetUniqueRandomClipIndex(audioInfo.Shot.Length, audioInfo.ShotLastUniqiueIndex); F3DAudio.PlayOneShotRandom(Weapon, audioInfo.Shot[audioInfo.ShotLastUniqiueIndex], audioInfo.ShotVolume, audioInfo.ShotPitch); }
// IMPACTS public static void OnProjectileImpact(AudioSource audioSource, WeaponAudioInfo audioInfo) { if (audioInfo.Hit == null || audioInfo.Hit.Length < 1) { return; } var random = F3DAudio.GetRandomClipIndex(audioInfo.Hit.Length); var hit = audioInfo.Hit[random]; audioSource.outputAudioMixerGroup = audioInfo.HitMixerGroup; F3DAudio.PlayOneShotRandom(audioSource, hit, audioInfo.HitVolume, audioInfo.HitPitch); }
// Jump public void OnJump() { var state = CharacterState.Jump; var surfaceClips = GetSurfaceClips(state); _lastFootstepsJumpIndex = F3DAudio.GetUniqueRandomClipIndex(surfaceClips.Length, _lastFootstepsJumpIndex); F3DAudio.PlayOneShotRandom(FootstepsJump, surfaceClips[_lastFootstepsJumpIndex], GetSurfaceVolume(state), GetSurfacePitch(state)); // // Grunt // if (Voice == null || VoiceClipsGrunt == null || VoiceClipsGrunt.Length <= 0) return; // _lastVoiceGruntIndex = GetUniqueRandomClipIndex(VoiceClipsGrunt.Length, -1); // -1 cancels out the unique index // Voice.Stop(); // PlayOneShotRandom(Voice, VoiceClipsGrunt[_lastVoiceGruntIndex], VoiceVolumeRandom, VoicePitchRandom); }