Esempio n. 1
0
 public GOAPNodePool(int _count)
 {
     for (int i = 0; i < _count; i++)
     {
         IdleList.Add(CreateNewUnit());
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 /// <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);
     }
 }