riversong code showcase
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.Pool;
|
||||
|
||||
namespace DanieleMarotta.RiversongCodeShowcase
|
||||
{
|
||||
public class PoolingService : IPoolingService
|
||||
{
|
||||
private Dictionary<int, object> _poolLookup = new();
|
||||
|
||||
public void AddPool<T>(int key, IObjectPool<T> pool) where T : class
|
||||
{
|
||||
_poolLookup.Add(key, pool);
|
||||
}
|
||||
|
||||
public IObjectPool<T> GetPool<T>(int key) where T : class
|
||||
{
|
||||
return _poolLookup.TryGetValue(key, out var pool) ? (IObjectPool<T>)pool : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user