Working generic object pooling, pool monitor editor tool and batch component adder editor tool
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user