private void PlayRandomFootstep(AudioClip[] stepSounds, IFirstPersonController controller) { if (stepSounds == null) { return; } var index = Random.Range(1, stepSounds.Length); controller.Audio.clip = stepSounds[index]; controller.Audio.PlayOneShot(controller.Audio.clip, controller.SoundVolume); stepSounds[index] = stepSounds[0]; stepSounds[0] = controller.Audio.clip; }
internal void PlayLandingSound(IFirstPersonController controller) { controller.Audio.pitch = Time.timeScale; var surface = controller.CurrentSurface; if (surface != null) { controller.Audio.PlayOneShot(surface.JumpingSound, controller.SoundVolume); } else { controller.Audio.PlayOneShot(GenericSurface.LandingSound, controller.SoundVolume); } }
internal void PlayFootStepSound(IFirstPersonController controller) { controller.Audio.pitch = Time.timeScale; var surface = controller.CurrentSurface; if (surface != null) { PlayRandomFootstep(surface.FootstepSounds, controller); } else { PlayRandomFootstep(GenericSurface.FootstepSounds, controller); } }