|
@@ -61,14 +61,14 @@ namespace KairoEngine.SFX
|
|
|
soundEmitters.Add(soundEmitter);
|
|
|
}
|
|
|
|
|
|
- public static void EmmitSound(string clipName, Vector3 position)
|
|
|
+ public static void EmmitSound(string clipName, Vector3 position, Transform parent = null)
|
|
|
{
|
|
|
if(instance == null) return;
|
|
|
if(instance.soundLibrary == null) return;
|
|
|
SFXClip clip = null;
|
|
|
if (instance.soundLibrary.clips.TryGetValue(clipName, out clip))
|
|
|
{
|
|
|
- EmmitSound(clip, position);
|
|
|
+ EmmitSound(clip, position, parent);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -76,8 +76,9 @@ namespace KairoEngine.SFX
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void EmmitSound(SFXClip clip, Vector3 position)
|
|
|
+ public static void EmmitSound(SFXClip clip, Vector3 position, Transform parent = null)
|
|
|
{
|
|
|
+ if(parent == null) parent = soundsParent.transform;
|
|
|
if(SoundController.instance == null)
|
|
|
{
|
|
|
Debug.LogError("Missing SoundController component in scene.");
|
|
@@ -94,9 +95,9 @@ namespace KairoEngine.SFX
|
|
|
else
|
|
|
{
|
|
|
GameObject soundEmitterObj;
|
|
|
- if(instance.soundEmitterPrefab != null) soundEmitterObj = GameObject.Instantiate(instance.soundEmitterPrefab, soundsParent.transform);
|
|
|
+ if(instance.soundEmitterPrefab != null) soundEmitterObj = GameObject.Instantiate(instance.soundEmitterPrefab, parent);
|
|
|
else soundEmitterObj = MasterObjectPooler.Instance.GetPool(soundEmitterPool).GetObject(position);
|
|
|
- soundEmitterObj.transform.parent = soundsParent.transform;
|
|
|
+ soundEmitterObj.transform.parent = parent;
|
|
|
SoundEmitter soundEmitter = soundEmitterObj.GetComponent<SoundEmitter>();
|
|
|
soundEmitter.Initialize(clip, position);
|
|
|
soundEmitters.Add(soundEmitter);
|