public Sound CreatePooledInstance(SoundClip sc, Vector3 position, GameObject linked = null) { Sound s = GetPooledInstance <Sound>(); s.source.clip = sc.clips[Random.Range(0, sc.clips.Count - 1)]; s.source.volume = sc.volume; s.source.pitch = sc.pitch; s.transform.position = position; s.source.loop = sc.loop; s.linked = linked; if (linked) { s.wasLinked = true; } else { s.wasLinked = false; } s.source.Play(); return(s); }
public Sound Play(SoundClip clip, Vector3 position, GameObject linked = null) { Sound s = soundPrefab.CreatePooledInstance(clip, position, linked); return(s); }