logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct ArsenalSnapshot

    Immutable representation of a weapon arsenal's state at a point in time.

    Implements
    IEquatable<ArsenalSnapshot>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.GameWeapon.Domain.ValueObjects
    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
    Type Description
    WeaponId

    ActiveIndex

    The index of Active within Weapons, or -1 when the arsenal is empty.

    Declaration
    public readonly int ActiveIndex
    Field Value
    Type Description
    int

    Count

    The number of weapons in the arsenal.

    Declaration
    public readonly int Count
    Field Value
    Type Description
    int

    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
    Type Description
    IReadOnlyList<WeaponId>

    Properties

    IsValid

    Whether this snapshot describes a non-empty arsenal with a valid active weapon.

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    bool

    Methods

    Equals(ArsenalSnapshot)

    Declaration
    public bool Equals(ArsenalSnapshot other)
    Parameters
    Type Name Description
    ArsenalSnapshot 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
    ValueType.Equals(object)

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    ValueType.ToString()

    Operators

    operator ==(ArsenalSnapshot, ArsenalSnapshot)

    Declaration
    public static bool operator ==(ArsenalSnapshot left, ArsenalSnapshot right)
    Parameters
    Type Name Description
    ArsenalSnapshot left
    ArsenalSnapshot right
    Returns
    Type Description
    bool

    operator !=(ArsenalSnapshot, ArsenalSnapshot)

    Declaration
    public static bool operator !=(ArsenalSnapshot left, ArsenalSnapshot right)
    Parameters
    Type Name Description
    ArsenalSnapshot left
    ArsenalSnapshot right
    Returns
    Type Description
    bool

    Implements

    IEquatable<T>
    In this article
    © 2026 Serenity. All Rights Reserved