Interface ICharacterSpawnService
Engine-agnostic service interface for spawning and releasing characters. Implementations handle pooling, instantiation, and lifecycle management in the infrastructure layer. Designed for future migration to Serenity.
Namespace: Serenity.Character.Application.Interfaces.Services
Assembly: Serenity.Character.Application.dll
Syntax
public interface ICharacterSpawnService
Properties
ActiveCount
Gets the number of currently active (spawned, not released) characters.
Declaration
int ActiveCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Release(CharacterId)
Releases a single character by its identity, returning it to the pool or destroying it as appropriate.
Declaration
void Release(CharacterId characterId)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterId | characterId | The identity of the character to release. |
ReleaseAll()
Releases all currently active characters, returning them to the pool or destroying them as appropriate.
Declaration
void ReleaseAll()
Spawn(string, float, float, float, float, float, float, float)
Spawns a character of the given archetype key at the specified world position and rotation. The archetype key is a string identifier that maps to a specific character configuration in the infrastructure layer.
Declaration
CharacterId Spawn(string characterKey, float posX, float posY, float posZ, float rotX, float rotY, float rotZ, float rotW)
Parameters
| Type | Name | Description |
|---|---|---|
| string | characterKey | String identifier for the character archetype/prefab. |
| float | posX | World position X. |
| float | posY | World position Y. |
| float | posZ | World position Z. |
| float | rotX | Rotation quaternion X. |
| float | rotY | Rotation quaternion Y. |
| float | rotZ | Rotation quaternion Z. |
| float | rotW | Rotation quaternion W. |
Returns
| Type | Description |
|---|---|
| CharacterId | The CharacterId of the spawned character, or default if spawn failed. |