|
|
|
|
|
|
private void InitPool() |
|
|
|
{ |
|
|
|
_factory = ScriptableObject.CreateInstance<SoundEmitterFactorySO>(); |
|
|
|
_factory.Prefab = _soundEmitterPrefab; |
|
|
|
_factory.Prefab.name = "SoundEmitter Factory"; |
|
|
|
_factory.prefab = _soundEmitterPrefab; |
|
|
|
_pool = ScriptableObject.CreateInstance<SoundEmitterPoolSO>(); |
|
|
|
_pool.name = "SoundEmitter Pool"; |
|
|
|
_pool.Factory = _factory; |
|
|
|
|
|
|
private void OnSoundEmitterFinishedPlaying(SoundEmitter soundEmitter) |
|
|
|
{ |
|
|
|
soundEmitter.OnSoundFinishedPlaying -= OnSoundEmitterFinishedPlaying; |
|
|
|
soundEmitter.StopSound(); |
|
|
|
Pool.Return(soundEmitter); |
|
|
|
} |
|
|
|
|