Exemple #1
0
 /// <summary>
 /// Plays the emitter if it isn't playing already.
 /// </summary>
 public static void PlayEmitterIfNotPlaying(FMODUnity.StudioEventEmitter fmodComponent)
 {
     if (!fmodComponent.IsPlaying())
     {
         fmodComponent.Play();
     }
 }
 public void AccessoriesButtonClickSound()
 {
     if (_noaccessories)
     {
         OnDisabled.Play();
     }
     else
     {
         OnClick.Play();
     }
 }
Exemple #3
0
 /// <summary>
 /// This function is pretty useless, use the functions already present on the StudioEventEmitter instead.
 /// <para></para>
 /// Either play or stop the inserted StudioEventEmitter-component.<para></para>
 /// TRUE = Play sound.
 /// <para></para> FALSE = Stop the sound.
 /// </summary>
 public static void PlayOrStopSound(FMODUnity.StudioEventEmitter fmodComponent, bool play)
 {
     if (play)
     {
         fmodComponent.Play();
     }
     else
     {
         fmodComponent.Stop();
     }
 }
Exemple #4
0
 /// <summary>
 /// Starts the target emitter to play, and calls the base method, thus invoking the OnTriggered event.
 /// </summary>
 public override void Trigger()
 {
     // A way to start (or stop) the EventEmitter playing. Although the official documentation has an example using the sendMessage("Play")
     // method, calling directly the Play() function is way better, because we avoid using Reflection.
     // See also: https://www.fmod.org/docs/content/generated/engine_new_unity/emitter.html
     if (action == EventEmitterTriggerAction.PLAY)
     {
         targetEmitter.Play();
     }
     else
     {
         targetEmitter.Stop();
     }
     base.Trigger();
 }