Struct ArsenalSnapshot
Immutable representation of a weapon arsenal's state at a point in time.
Assembly: Serenity.GameWeapon.Domain.dll
Syntax
public readonly struct ArsenalSnapshot : IEquatable<ArsenalSnapshot>
Constructors
ArsenalSnapshot(WeaponId, int, int, IReadOnlyList<WeaponId>)
Creates a new ArsenalSnapshot.
Declaration
public ArsenalSnapshot(WeaponId active, int activeIndex, int count, IReadOnlyList<WeaponId> weapons)
Parameters
| Type |
Name |
Description |
| WeaponId |
active |
The currently active weapon.
|
| int |
activeIndex |
The index of active within weapons, or -1 when empty.
|
| int |
count |
The number of weapons in the arsenal.
|
| IReadOnlyList<WeaponId> |
weapons |
The weapons in the arsenal, in order.
|
Fields
Active
The currently active weapon. The default WeaponId when the arsenal is empty.
Declaration
public readonly WeaponId Active
Field Value
ActiveIndex
The index of Active within Weapons, or -1 when the arsenal is empty.
Declaration
public readonly int ActiveIndex
Field Value
Count
The number of weapons in the arsenal.
Declaration
public readonly int Count
Field Value
Weapons
The weapons in the arsenal, in order, exposed read-only so a caller cannot mutate the
arsenal through its own snapshot. When obtained via WeaponArsenal.ToSnapshot(),
this wraps a fresh defensive copy created for that call.
Declaration
public readonly IReadOnlyList<WeaponId> Weapons
Field Value
Properties
IsValid
Whether this snapshot describes a non-empty arsenal with a valid active weapon.
Declaration
public bool IsValid { get; }
Property Value
Methods
Equals(ArsenalSnapshot)
Declaration
public bool Equals(ArsenalSnapshot other)
Parameters
Returns
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| object |
obj |
|
Returns
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
ToString()
Declaration
public override string ToString()
Returns
Overrides
Operators
operator ==(ArsenalSnapshot, ArsenalSnapshot)
Declaration
public static bool operator ==(ArsenalSnapshot left, ArsenalSnapshot right)
Parameters
Returns
operator !=(ArsenalSnapshot, ArsenalSnapshot)
Declaration
public static bool operator !=(ArsenalSnapshot left, ArsenalSnapshot right)
Parameters
Returns
Implements