Struct WeaponSnapshot
Immutable representation of a weapon's state at a point in time.
Implements
Inherited Members
Namespace: Serenity.GameWeapon.Domain.ValueObjects
Assembly: Serenity.GameWeapon.Domain.dll
Syntax
public readonly struct WeaponSnapshot : IEquatable<WeaponSnapshot>
Constructors
WeaponSnapshot(WeaponId, int, int, FireMode, bool, bool)
Creates a new WeaponSnapshot with an infinite ammo reserve.
Declaration
public WeaponSnapshot(WeaponId id, int currentAmmo, int maxCapacity, FireMode fireMode, bool isTriggerPressed, bool isReloading)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
| int | currentAmmo | The current ammo count. |
| int | maxCapacity | The max magazine capacity. |
| FireMode | fireMode | The fire mode. |
| bool | isTriggerPressed | Whether the trigger is pressed. |
| bool | isReloading | Whether the weapon is reloading. |
WeaponSnapshot(WeaponId, int, int, FireMode, bool, bool, int, int, bool)
Creates a new WeaponSnapshot.
Declaration
public WeaponSnapshot(WeaponId id, int currentAmmo, int maxCapacity, FireMode fireMode, bool isTriggerPressed, bool isReloading, int reserveAmmo, int reserveMaxCapacity, bool hasInfiniteReserve)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponId | id | The weapon identity. |
| int | currentAmmo | The current ammo count. |
| int | maxCapacity | The max magazine capacity. |
| FireMode | fireMode | The fire mode. |
| bool | isTriggerPressed | Whether the trigger is pressed. |
| bool | isReloading | Whether the weapon is reloading. |
| int | reserveAmmo | The current ammo count held in reserve. |
| int | reserveMaxCapacity | The maximum reserve capacity. |
| bool | hasInfiniteReserve | Whether the reserve is unlimited. |
Fields
CurrentAmmo
The current ammo count in the magazine.
Declaration
public readonly int CurrentAmmo
Field Value
| Type | Description |
|---|---|
| int |
FireMode
The current fire mode.
Declaration
public readonly FireMode FireMode
Field Value
| Type | Description |
|---|---|
| FireMode |
HasInfiniteReserve
Whether the reserve is unlimited.
Declaration
public readonly bool HasInfiniteReserve
Field Value
| Type | Description |
|---|---|
| bool |
Id
The weapon identity.
Declaration
public readonly WeaponId Id
Field Value
| Type | Description |
|---|---|
| WeaponId |
IsReloading
Whether the weapon is currently reloading.
Declaration
public readonly bool IsReloading
Field Value
| Type | Description |
|---|---|
| bool |
IsTriggerPressed
Whether the trigger is currently pressed.
Declaration
public readonly bool IsTriggerPressed
Field Value
| Type | Description |
|---|---|
| bool |
MaxCapacity
The maximum magazine capacity.
Declaration
public readonly int MaxCapacity
Field Value
| Type | Description |
|---|---|
| int |
ReserveAmmo
The current ammo count held in reserve.
Declaration
public readonly int ReserveAmmo
Field Value
| Type | Description |
|---|---|
| int |
ReserveMaxCapacity
The maximum reserve capacity. Negative when HasInfiniteReserve is true.
Declaration
public readonly int ReserveMaxCapacity
Field Value
| Type | Description |
|---|---|
| int |
Properties
IsEmpty
Whether the magazine is empty.
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Equals(WeaponSnapshot)
Declaration
public bool Equals(WeaponSnapshot other)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponSnapshot | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
operator ==(WeaponSnapshot, WeaponSnapshot)
Declaration
public static bool operator ==(WeaponSnapshot left, WeaponSnapshot right)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponSnapshot | left | |
| WeaponSnapshot | right |
Returns
| Type | Description |
|---|---|
| bool |
operator !=(WeaponSnapshot, WeaponSnapshot)
Declaration
public static bool operator !=(WeaponSnapshot left, WeaponSnapshot right)
Parameters
| Type | Name | Description |
|---|---|---|
| WeaponSnapshot | left | |
| WeaponSnapshot | right |
Returns
| Type | Description |
|---|---|
| bool |