24 lines
913 B
C#
24 lines
913 B
C#
using UnityEngine;
|
||
|
||
namespace BaseGames.Core
|
||
{
|
||
/// <summary>
|
||
/// 全局对象池服务接口。
|
||
/// 通过 ServiceLocator 访问,解耦调用方与 GlobalObjectPool 具体实现。
|
||
/// </summary>
|
||
public interface IObjectPoolService
|
||
{
|
||
/// <summary>从池中取出指定 Component 类型的对象,并激活到指定位置/朝向。</summary>
|
||
T Spawn<T>(string key, Vector3 position, Quaternion rotation) where T : Component;
|
||
|
||
/// <summary>从池中取出 GameObject,并激活到指定位置/朝向。</summary>
|
||
GameObject Spawn(string key, Vector3 position, Quaternion rotation);
|
||
|
||
/// <summary>将对象归还到池中(停用并入队)。</summary>
|
||
void Despawn(string key, Pool.PooledObject po);
|
||
|
||
/// <summary>清空指定 key 的对象池(场景卸载时调用)。</summary>
|
||
void ClearPool(string key);
|
||
}
|
||
}
|