public void UpdateAudioJob(AudioManager.AudioJob job) { if (job.audioType == AudioName.FallingWind) { float t = Mathf.InverseLerp(windSpeedThreshold, terminalVelocity, curFallingSpeed); targetHighWindVolume = highWindMaxVolume * t; job.audio.volume = Mathf.Lerp(job.audio.volume, targetHighWindVolume, targetHighWindVolumeLerpSpeed); } else { if (nearbyCollider != null) { float speedT = Mathf.InverseLerp(windSpeedThreshold, terminalVelocity, curFallingSpeed); float distanceT = 1 - Mathf.InverseLerp(lowWindSoundMinDistance, thisTrigger.radius, distanceToNearbyCollider); targetLowWindVolume = speedT * distanceT; } float curVolume = job.audio.volume; float lerpSpeed = targetLowWindVolume > curVolume ? targetLowWindVolumeIncreaseLerpSpeed : targetLowWindVolumeDecreaseLerpSpeed; job.audio.volume = Mathf.Lerp(curVolume, targetLowWindVolume, Time.deltaTime * lerpSpeed); } }
public static void UpdateAudio(this CustomAudioJob customAudioJob, AudioManager.AudioJob audioJob) { try { customAudioJob.UpdateAudioJob(audioJob); } catch (Exception) { audioJob.Stop(); } }
public void UpdateAudioJob(AudioManager.AudioJob job) { const float timeToFadeVolume = 2f; job.audio.loop = playerIsInFakeBlackRoom; if (!job.audio.loop) { job.audio.volume -= Time.deltaTime / timeToFadeVolume; } else { job.audio.volume += Time.deltaTime / timeToFadeVolume; } job.audio.panStereo = Mathf.Sin(Time.time); }
public Transform GetObjectToPlayAudioOn(AudioManager.AudioJob _) => transform;