This commit is contained in:
CortexCore
2023-11-15 23:54:54 +08:00
parent ee3ecec6cb
commit 3c837a4a33
356 changed files with 73756 additions and 26493 deletions

View File

@@ -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)