Exemple #1
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();
     }
 }
        void OnDie()
        {
            IsDead = true;

            // Tell the weapons manager to switch to a non-existing weapon in order to lower the weapon
            m_WeaponsManager.SwitchToWeaponIndex(-1, true);

            FMODUnity.RuntimeManager.PlayOneShot(DeathSfx);

            lowHealth.Stop();

            EventManager.Broadcast(Events.PlayerDeathEvent);
        }
Exemple #3
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();
 }
Exemple #4
0
 private void OnDisable()
 {
     helicopterSound?.Stop();
 }