using System.Collections.Generic; using UnityEngine.Pool; namespace DanieleMarotta.RiversongCodeShowcase { public class PoolingService : IPoolingService { private Dictionary _poolLookup = new(); public void AddPool(int key, IObjectPool pool) where T : class { _poolLookup.Add(key, pool); } public IObjectPool GetPool(int key) where T : class { return _poolLookup.TryGetValue(key, out var pool) ? (IObjectPool)pool : null; } } }