25 lines
933 B
C#
25 lines
933 B
C#
using UnityEngine;
|
|
|
|
namespace FlappyBird.Core
|
|
{
|
|
public interface IObjectPoolManager
|
|
{
|
|
/// <summary>
|
|
/// Registers a new prefab type with the pooling system.
|
|
/// </summary>
|
|
/// <typeparam name="T">The component type that implements IPoolable.</typeparam>
|
|
/// <param name="prefab">The GameObject prefab to instantiate.</param>
|
|
/// <param name="initialSize">How many instances to pre-warm in the pool.</param>
|
|
void RegisterPool<T>(GameObject prefab, int initialSize = 0) where T : Component, IPoolable;
|
|
|
|
/// <summary>
|
|
/// Retrieves an instance from the pool, or creates a new one if the pool is empty.
|
|
/// </summary>
|
|
T Get<T>() where T : Component, IPoolable;
|
|
|
|
/// <summary>
|
|
/// Returns an instance to the pool and deactivates it.
|
|
/// </summary>
|
|
void Return<T>(T item) where T : Component, IPoolable;
|
|
}
|
|
} |