1
This commit is contained in:
@@ -27,13 +27,23 @@ namespace BITKit
|
||||
private ObjectPool<T> pool;
|
||||
|
||||
private readonly List<T> _list=new();
|
||||
private int _offset;
|
||||
|
||||
public int DefaultCapacity
|
||||
{
|
||||
get => defaultCapacity;
|
||||
set => defaultCapacity = value;
|
||||
}
|
||||
|
||||
public T Get(T element = null, Transform _root = null)
|
||||
{
|
||||
if (_list.Count == defaultCapacity)
|
||||
{
|
||||
return _list[_offset = _offset/_list.Count+1];
|
||||
var next = _list[0];
|
||||
next.gameObject.SetActive(false);
|
||||
_list.RemoveAt(0);
|
||||
_list.Add(next);
|
||||
next.gameObject.SetActive(true);
|
||||
return next;
|
||||
}
|
||||
|
||||
if (element is not null)
|
||||
|
Reference in New Issue
Block a user