Interface IGameRailService
Service interface for managing rail-based movement.
Namespace: Serenity.GameRail.Application.Interfaces
Assembly: Serenity.GameRail.Application.dll
Syntax
public interface IGameRailService : IService, IFoundationSettings
Remarks
The rail system is intentionally passive. Progress updates are driven by external systems (GameLoop, AI, Input). This service provides read/write access to rail progress and exposes immutable state snapshots.
Methods
AdvanceProgress(RailId, float)
Advances the progress of an entity along the specified rail by a delta.
Declaration
void AdvanceProgress(RailId id, float delta)
Parameters
| Type | Name | Description |
|---|---|---|
| RailId | id | The rail identity. |
| float | delta | The amount to advance. Clamped to [0, 1]. |
ConfigureRail(RailPathConfig)
Configures and registers a rail path from a configuration model. Convenience method that extracts RailId and nodes from the config.
Declaration
void ConfigureRail(RailPathConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| RailPathConfig | config | Immutable rail path configuration. |
GetProgress(RailId)
Gets the current progress along the specified rail.
Declaration
RailProgress GetProgress(RailId id)
Parameters
| Type | Name | Description |
|---|---|---|
| RailId | id | The rail identity. |
Returns
| Type | Description |
|---|---|
| RailProgress | The current normalized progress. |
GetSnapshot(RailId)
Returns an immutable snapshot of the specified rail's state.
Declaration
RailSnapshot GetSnapshot(RailId id)
Parameters
| Type | Name | Description |
|---|---|---|
| RailId | id | The rail identity. |
Returns
| Type | Description |
|---|---|
| RailSnapshot | A RailSnapshot of the rail's current state. |
RegisterRail(RailId, RailNodePosition[])
Registers a rail with the specified identity and node positions.
Declaration
void RegisterRail(RailId id, RailNodePosition[] nodes)
Parameters
| Type | Name | Description |
|---|---|---|
| RailId | id | The rail identity. |
| RailNodePosition[] | nodes | The ordered sequence of node positions. |
ResetProgress(RailId)
Resets the specified rail's progress to the start.
Declaration
void ResetProgress(RailId id)
Parameters
| Type | Name | Description |
|---|---|---|
| RailId | id | The rail identity. |
SetProgress(RailId, RailProgress)
Sets the progress of an entity along the specified rail.
Declaration
void SetProgress(RailId id, RailProgress progress)
Parameters
| Type | Name | Description |
|---|---|---|
| RailId | id | The rail identity. |
| RailProgress | progress | The new normalized progress value. |