Beispiel #1
0
 public void StopAudio(VehicleSounds _sound)
 {
     if (_sound == VehicleSounds.Movement && wheelAudio.isPlaying)
     {
         wheelAudio.Stop();
     }
     else if (_sound == VehicleSounds.Drilling && drillAudio.isPlaying)
     {
         drillAudio.Stop();
     }
     else if (engineAudio != null && _sound == VehicleSounds.Engine && engineAudio.isPlaying)
     {
         StartCoroutine(FadeOutEngine());
     }
 }
Beispiel #2
0
 public void PlayAudio(VehicleSounds _sound)
 {
     if (_sound == VehicleSounds.Movement && !wheelAudio.isPlaying)
     {
         vehicle.GetPart(out PartWheel _wheel);
         wheelAudio.clip = _wheel.Sound;
         wheelAudio.Play();
     }
     else if (_sound == VehicleSounds.Drilling && !drillAudio.isPlaying)
     {
         drillAudio.clip = drillSound;
         drillAudio.Play();
     }
     else if (engineAudio != null && _sound == VehicleSounds.Engine && !engineAudio.isPlaying)
     {
         vehicle.GetPart(out PartEngine _engine);
         if (_engine != null)
         {
             engineAudio.clip = _engine.Sound;
             engineAudio.Play();
             StartCoroutine(FadeInEngine());
         }
     }
 }