Interface ISpawnFactory
Application port for creating and destroying spawned entity instances.
Namespace: Serenity.GameSpawner.Application.Interfaces.Factories
Assembly: Serenity.GameSpawner.Application.dll
Syntax
public interface ISpawnFactory
Remarks
Implementations handle the engine-specific instantiation logic (e.g. Unity GameObject.Instantiate, prefab pooling, etc.). The business layer uses this abstraction to remain engine-agnostic.
Methods
Create(SpawnType)
Creates a new entity instance for the given spawn type.
Declaration
SpawnHandle Create(SpawnType type)
Parameters
| Type | Name | Description |
|---|---|---|
| SpawnType | type | The logical type of entity to create. |
Returns
| Type | Description |
|---|---|
| SpawnHandle | An opaque SpawnHandle referencing the created instance. |
Destroy(SpawnHandle)
Destroys or returns to pool the entity referenced by the handle.
Declaration
void Destroy(SpawnHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| SpawnHandle | handle | The handle of the entity to destroy. |
DestroyAll(SpawnType)
Destroys or returns to pool all active entities of the specified type.
Declaration
void DestroyAll(SpawnType type)
Parameters
| Type | Name | Description |
|---|---|---|
| SpawnType | type | The spawn type to destroy. |