コード例 #1
0
        /// <summary>
        /// Spawned objects must call this to destroy themselves (i.e. re-enter the inactive pool).
        /// </summary>
        /// <param name="bubble">GameObject to "destroy" (return to inactive pool).</param>
        public void Destroy(GameObject go)
        {
            Transform goT = go.GetComponent <Transform>();

            ActivePool.Remove(goT);
            goT.parent = this.InactivePool;
        }
コード例 #2
0
ファイル: ObjectPool.cs プロジェクト: smitdylan2001/HKU_GDV1
 /// <summary>
 /// Return active item to inactive item list
 /// </summary>
 public T ReturnObjectToInactive(T item)
 {
     if (ActivePool.Contains(item))
     {
         ActivePool.Remove(item);
     }
     item.OnDisable();
     item.Active = false;
     InactivePool.Add(item);
     return(item);
 }