logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct ScoreValue

    Value container for a single score metric, combining a numeric value with its kind. Immutable value object that supports equality comparison.

    Implements
    IEquatable<ScoreValue>
    Inherited Members
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.Score.Domain.ValueObjects
    Assembly: Serenity.Score.Domain.dll
    Syntax
    public readonly struct ScoreValue : IEquatable<ScoreValue>

    Constructors

    ScoreValue(float, ScoreMetricKind)

    Creates a new ScoreValue with the specified amount and kind.

    Declaration
    public ScoreValue(float amount, ScoreMetricKind kind)
    Parameters
    Type Name Description
    float amount

    The numeric value.

    ScoreMetricKind kind

    The metric interpretation kind.

    Fields

    Amount

    The numeric value of this score metric.

    Declaration
    public readonly float Amount
    Field Value
    Type Description
    float

    Kind

    The kind that defines how this metric is interpreted.

    Declaration
    public readonly ScoreMetricKind Kind
    Field Value
    Type Description
    ScoreMetricKind

    Methods

    Add(float)

    Returns a new ScoreValue with the amount added.

    Declaration
    public ScoreValue Add(float delta)
    Parameters
    Type Name Description
    float delta

    The amount to add.

    Returns
    Type Description
    ScoreValue

    A new ScoreValue with the updated amount.

    Divide(float)

    Returns a new ScoreValue with the amount divided.

    Declaration
    public ScoreValue Divide(float divisor)
    Parameters
    Type Name Description
    float divisor

    The divisor. Must not be zero.

    Returns
    Type Description
    ScoreValue

    A new ScoreValue with the updated amount.

    Equals(ScoreValue)

    Declaration
    public bool Equals(ScoreValue other)
    Parameters
    Type Name Description
    ScoreValue 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()

    Multiply(float)

    Returns a new ScoreValue with the amount multiplied.

    Declaration
    public ScoreValue Multiply(float factor)
    Parameters
    Type Name Description
    float factor

    The multiplication factor.

    Returns
    Type Description
    ScoreValue

    A new ScoreValue with the updated amount.

    Reset()

    Returns a zero-value ScoreValue of the same kind.

    Declaration
    public ScoreValue Reset()
    Returns
    Type Description
    ScoreValue

    A new ScoreValue with amount set to zero.

    Subtract(float)

    Returns a new ScoreValue with the amount subtracted.

    Declaration
    public ScoreValue Subtract(float delta)
    Parameters
    Type Name Description
    float delta

    The amount to subtract.

    Returns
    Type Description
    ScoreValue

    A new ScoreValue with the updated amount.

    ToString()

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

    WithAmount(float)

    Returns a new ScoreValue with the specified amount, preserving the kind.

    Declaration
    public ScoreValue WithAmount(float amount)
    Parameters
    Type Name Description
    float amount

    The new amount.

    Returns
    Type Description
    ScoreValue

    A new ScoreValue with the updated amount.

    Operators

    operator ==(ScoreValue, ScoreValue)

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

    operator !=(ScoreValue, ScoreValue)

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

    Implements

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