public void OnBwoink(NetUserId channel) { var open = IsOpen; Open(); ChannelSelector.RefreshDecorators(); ChannelSelector.Sort(); if (!open) { SelectChannel(channel); } }
private static Sound LoadSoundToChannel(ChannelSelector channelSelector, string path, bool looping, bool paused, float fadeinTime) { var sound = new Sound(); var channel = channelSelector(); if (channel == null) { return(sound); } var r = UnityEngine.Resources.Load(path); var clip = r as UnityEngine.AudioClip; if (clip == null) { return(sound); } channel.SamplePath = path; channel.Play(sound, clip, looping, paused, fadeinTime); return(sound); }
public static Sound Play(string path, AudioChannelGroup group, bool looping = false, float priority = 0.5f, float fadeinTime = 0f, bool paused = false, float volume = 1f, float pan = 0f, float pitch = 1f) { ChannelSelector channelSelector = () => { var channel = AllocateChannel(priority); if (channel != null) { if (channel.Sound != null) { channel.Sound.Channel = NullAudioChannel.Instance; } channel.Group = group; channel.Priority = priority; channel.Volume = volume; channel.Pitch = pitch; channel.Pan = pan; } return(channel); }; var sound = LoadSoundToChannel(channelSelector, path, looping, paused, fadeinTime); return(sound); }