public void OnSound(PlaySoundEventArgs args) { if (this.transform.GetInstanceID() != args.ReceiverInstanceID) { return; } this._audioSource.PlayOneShot(args.Sound); }
void imlInterp_PlaySound(object sender, PlaySoundEventArgs e) { LoggingService.AddLogEntry(LogLevel.Extended, "(Line " + lineNumber + ") Playing sound at " + e.SoundFilename, false); // If the line isn't in use, don't do anything if (!telecomProvider.IsLineInUse(lineNumber)) { imlInterp.SignalEventCallback(e.EventToken); return; } imlScriptEventToken = e.EventToken; try { telecomProvider.PlaySound(lineNumber, e.SoundFilename, e.Loop); } catch (Exception ex) { LoggingService.AddLogEntry(LogLevel.ErrorsOnly, "(Line " + lineNumber + ") Unable to play sound at " + e.SoundFilename, true); imlInterp.SignalEventCallback(e.EventToken); } }
public void OnPlaySoundRequested(object sender, PlaySoundEventArgs e) { Play(e.Sound); }