public static void SendPlayAudioClip(string resourcePath, bool pitchModulation = false, float delay = 0f) { if (NetworkManager.singleton != null) { var msg = new SingedMessages.PlayAudioClipMessage(); msg.resourcePath = resourcePath; msg.pitchModulation = pitchModulation; msg.delay = delay; NetworkManager.singleton.client.Send((short)SingedMessages.SingedMessageKind.playAudioClip, msg); } }
public void PlayAudioClip(SingedMessages.PlayAudioClipMessage msg) { var clip = PrefabRegistry.singleton.GetResource <AudioClip>(msg.resourcePath); if (clip != null) { if (msg.delay != 0f) { PlayClipDelayed(msg.delay, clip, msg.pitchModulation); } else { PlayAudioClip(clip, msg.pitchModulation); } } }