Files
zeling_v2/Assets/Scripts/Core/IObjectPoolService.cs
2026-05-12 15:34:08 +08:00

24 lines
913 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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);
}
}