Interface IGameWeaponService
Service interface for managing generic weapon state and actions.
Namespace: Serenity.GameWeapon.Application.Interfaces
Assembly: Serenity.GameWeapon.Application.dll
Syntax
public interface IGameWeaponService : IService, IFoundationSettings
Remarks
Weapon actions express intent, not immediate effects. Timing, targeting, and combat consequences are handled by other systems. Implementations coordinate WeaponState transitions while enforcing weapon invariants (e.g. no firing with empty magazine).
Methods
ConsumeAmmo(WeaponId)
Consumes one round of ammo from the specified weapon's magazine.
Declaration
bool ConsumeAmmo(WeaponId id)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
Returns
| Type | Description |
|---|---|
| bool | True if ammo was consumed; false if the magazine is empty. |
GetSnapshot(WeaponId)
Returns an immutable snapshot of the specified weapon's state.
Declaration
WeaponSnapshot GetSnapshot(WeaponId id)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
Returns
| Type | Description |
|---|---|
| WeaponSnapshot | A WeaponSnapshot of the weapon's current state. |
RegisterWeapon(WeaponId, int, FireMode)
Registers a weapon with the specified identity and configuration.
Declaration
void RegisterWeapon(WeaponId id, int maxCapacity, FireMode fireMode)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
| int | maxCapacity | The maximum magazine capacity. |
| FireMode | fireMode | The initial fire mode. |
ReloadComplete(WeaponId, int)
Marks a reload as complete for the specified weapon.
Declaration
void ReloadComplete(WeaponId id, int ammoLoaded)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
| int | ammoLoaded | The number of rounds loaded into the magazine. |
ReloadRequested(WeaponId)
Requests a reload for the specified weapon.
Declaration
void ReloadRequested(WeaponId id)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
SetFireMode(WeaponId, FireMode)
Sets the fire mode for the specified weapon.
Declaration
void SetFireMode(WeaponId id, FireMode fireMode)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
| FireMode | fireMode | The new fire mode. |
TriggerPressed(WeaponId)
Signals that the trigger has been pressed.
Declaration
void TriggerPressed(WeaponId id)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
TriggerReleased(WeaponId)
Signals that the trigger has been released.
Declaration
void TriggerReleased(WeaponId id)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |