Working generic object pooling, pool monitor editor tool and batch component adder editor tool

This commit is contained in:
Michal Pikulski
2025-09-16 15:02:50 +02:00
parent bcc6f05058
commit 75be338065
26 changed files with 1393 additions and 469 deletions

View File

@@ -1,11 +1,12 @@
using UnityEngine;
using Pooling;
namespace Minigames.DivingForPictures
{
/// <summary>
/// Represents a single bubble, handling its movement, wobble effect, scaling, and sprite assignment.
/// </summary>
public class Bubble : MonoBehaviour
public class Bubble : MonoBehaviour, IPoolableWithReference<BubblePool>
{
public float speed = 1f;
public float wobbleSpeed = 1f;
@@ -87,6 +88,22 @@ namespace Minigames.DivingForPictures
parentPool = pool;
}
/// <summary>
/// Called when the object is retrieved from the pool.
/// </summary>
public void OnSpawn()
{
ResetState();
}
/// <summary>
/// Called when the object is returned to the pool.
/// </summary>
public void OnDespawn()
{
// Nothing to do here for now, but we could clean up resources
}
/// <summary>
/// Sets the main sprite for the bubble.
/// </summary>