using Core; using UnityEngine; using Pooling; namespace Minigames.DivingForPictures { /// /// Manages a pool of bubble objects to reduce garbage collection overhead. /// public class BubblePool : BaseObjectPool { /// /// Gets a bubble from the pool, or creates a new one if the pool is empty /// /// A bubble instance ready to use public Bubble GetBubble() { Bubble bubble = Get(); // Set reference to this pool so the bubble can return itself bubble.SetPool(this); return bubble; } /// /// Returns a bubble to the pool /// /// The bubble to return to the pool public void ReturnBubble(Bubble bubble) { Return(bubble); } /// /// Logs pool statistics /// public override void LogPoolStats() { Logging.Debug($"[BubblePool] Pooled bubbles: {pooledObjects.Count}/{maxPoolSize} (Created: {totalCreated}, Returned: {totalReturned})"); } } }