Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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);
            }
        }