Interface IRecyclingSpawnFactory
Optional capability port for ISpawnFactory implementations that can park and resume an instance instead of destroying and recreating it.
Inherited Members
Namespace: Serenity.GameSpawner.Application.Interfaces.Factories
Assembly: Serenity.GameSpawner.Application.dll
Syntax
public interface IRecyclingSpawnFactory : ISpawnFactory
Remarks
Implementing this interface opts a factory into real instance reuse: the service checks for it and, when present, drives Deactivate(SpawnHandle)/Reactivate(SpawnHandle) instead of Destroy(SpawnHandle). Factories that only implement ISpawnFactory keep the existing destroy-on-despawn behavior.
Methods
Deactivate(SpawnHandle)
Parks the instance referenced by the handle for later reuse.
Declaration
bool Deactivate(SpawnHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| SpawnHandle | handle | The handle of the instance to park. |
Returns
| Type | Description |
|---|---|
| bool | True if the handle was known and the instance was parked; otherwise false. |
Reactivate(SpawnHandle)
Brings a previously parked instance back into active use.
Declaration
bool Reactivate(SpawnHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| SpawnHandle | handle | The handle of the instance to resume. |
Returns
| Type | Description |
|---|---|
| bool | True if the handle was known and the instance is alive; otherwise false. |