Interface ICharacterService
Service interface for managing character instances in a rail shooter stage. Tracks per-character state for the four characters: Blue, Red, Melee, Orange.
Namespace: Serenity.Character.Application.Interfaces.Services
Assembly: Serenity.Character.Application.dll
Syntax
public interface ICharacterService : IService, IFoundationSettings
Properties
AliveCharacterCount
Gets the count of currently alive characters.
Declaration
int AliveCharacterCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
ActivateCharacter(CharacterId)
Activates an character (transitions from Spawning to Alive).
Declaration
void ActivateCharacter(CharacterId id)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterId | id | The character identity. |
ConfigureCharacters(CharacterConfig[])
Configures character-specific settings for character spawning. Must be called before registering characters to apply per-character defaults.
Declaration
void ConfigureCharacters(CharacterConfig[] configs)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterConfig[] | configs | Array of character configurations. |
FinishCharacterDeath(CharacterId)
Marks an character as fully dead (after death animation).
Declaration
void FinishCharacterDeath(CharacterId id)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterId | id | The character identity. |
HitCharacter(CharacterId, int)
Applies a hit to an character. Returns true if the character was killed.
Declaration
bool HitCharacter(CharacterId id, int damage = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterId | id | The character identity. |
| int | damage | Damage to apply (typically 1). |
Returns
| Type | Description |
|---|---|
| bool | True if the character was killed by this hit. |
RegisterCharacter(CharacterId, object, int)
Registers a new character instance.
Declaration
void RegisterCharacter(CharacterId id, object character, int maxHealth)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterId | id | Unique identifier for this character. |
| object | character | The character character. |
| int | maxHealth | Hit points before death. |
TryGetSnapshot(CharacterId, out CharacterSnapshot)
Returns the snapshot of a specific character.
Declaration
bool TryGetSnapshot(CharacterId id, out CharacterSnapshot snapshot)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterId | id | The character identity. |
| CharacterSnapshot | snapshot | The character snapshot if found. |
Returns
| Type | Description |
|---|---|
| bool | True if the character was found. |
UnregisterCharacter(CharacterId)
Removes the character from tracking.
Declaration
void UnregisterCharacter(CharacterId id)
Parameters
| Type | Name | Description |
|---|---|---|
| CharacterId | id | The character identity. |