Beispiel #1
0
    /**
     * General implementation for the rtpc event
     * @param RTPCID the name of the rtpc
     * @param Value the target value
     */
    private void SetRTPCValue_Implementation(string RTPCID, float Value)
    {
        SoundEvent rtpcEvent = GetSoundEventFromID(RTPCID.GetHashCode());

        // Precondition
        if (rtpcEvent == null)
        {
            DisplayWarningMessage("AudioEventManager : The rtpc event " + RTPCID + " was not found");
            return;
        }

        GameObject soundObject = GetTargetFromID(rtpcEvent.EventToStop.GetHashCode());

        if (soundObject == null)
        {
            DisplayLogMessage("AudioEventManager : No target found to apply the RTPC");
            return;
        }

        AudioSource[] sources = soundObject.GetComponents <AudioSource>();

        // Builds the parameters pack
        RTPCEventParameters parameters = new RTPCEventParameters();

        parameters.MusicMixer = MusicMixer;
        parameters.SfxMixer   = SFXMixer;
        parameters.AudioSources.AddRange(sources);

        rtpcEvent.EventRTPC.OnRTPCUpdate(parameters, Value);
    }
Beispiel #2
0
 /**
  * Called for each RTPC events
  *
  * @param parameters All informations about the target event
  * @param value      The target value
  */
 public override void OnRTPCUpdate(RTPCEventParameters parameters, float value)
 {
     parameters.AudioSources[0].pitch = value;
 }
 /**
  * Called after each call of SetRTPCValue()
  *
  * @param parameters This the parameter pack of the RTPC event. It contains
  * all audio source linked to the event and the two main audio mixer
  * @param value This is the value passed to SetRTPCValue()
  */
 public abstract void OnRTPCUpdate(RTPCEventParameters parameters, float value);