public GOAPNodePool(int _count) { for (int i = 0; i < _count; i++) { IdleList.Add(CreateNewUnit()); } }
public virtual void InitCount() { if (IdleList.Count + WorkList.Count > maxCount) { return; } for (int i = 0; i < maxCount; i++) { GameObject unit = CreateNewUnit(); unit.SetActive(false); unit.transform.SetParent(groupParent); IdleList.Add(unit); } }
/// <summary> 回收 </summary> public new void Recycle(T _unit) { WorkList.Remove(_unit); if (_unit != null) { IdleList.Add(_unit); OnBeforeRecycle(_unit); IPoolable recyclable; if ((recyclable = _unit as IPoolable) != null) { recyclable.OnRecycled(); } OnAfterRecycle(_unit); } }