logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class ScoreThresholdCondition

    Met while a score metric compares as authored against a value.

    Inheritance
    object
    ScoreThresholdCondition
    Namespace: Serenity.Achievements.Infrastructure.Conditions
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    [AchievementConditionCategory(AchievementConditionCategory.Metrics)]
    public class ScoreThresholdCondition : AchievementCondition
    Remarks

    Keeps no state of its own: the Score aggregate already owns the number and already persists it, so counting it a second time here would create two answers to the same question. A metric the project never registered reads as zero rather than as a failure, so a rule authored before the metric exists degrades to "not yet" instead of never evaluating.

    Constructors

    ScoreThresholdCondition()

    Creates an unauthored condition, as Unity's polymorphic serializer does.

    Declaration
    public ScoreThresholdCondition()

    ScoreThresholdCondition(string, ScoreComparator, float)

    Creates a condition comparing a score metric against a value.

    Declaration
    public ScoreThresholdCondition(string scoreKey, ScoreComparator comparator, float value)
    Parameters
    Type Name Description
    string scoreKey

    The score metric to read.

    ScoreComparator comparator

    How the metric is compared.

    float value

    The value the metric is compared against.

    Properties

    Comparator

    How the metric is compared against Value.

    Declaration
    public ScoreComparator Comparator { get; }
    Property Value
    Type Description
    ScoreComparator

    DisplayName

    Declaration
    public override string DisplayName { get; }
    Property Value
    Type Description
    string

    NeedsTick

    Polled, because a score metric changes without telling anyone. A leaf that reads state it cannot be notified about has to be asked, or a tree made only of these would never be evaluated at all.

    Declaration
    public override bool NeedsTick { get; }
    Property Value
    Type Description
    bool

    ScoreKeyName

    The score metric this condition reads.

    Declaration
    public string ScoreKeyName { get; }
    Property Value
    Type Description
    string

    Value

    The value the metric is compared against.

    Declaration
    public float Value { get; }
    Property Value
    Type Description
    float

    Methods

    Describe(bool)

    Declaration
    public override string Describe(bool isNested)
    Parameters
    Type Name Description
    bool isNested
    Returns
    Type Description
    string

    GetProgress(in AchievementEvaluationContext)

    Declaration
    public override AchievementConditionProgress GetProgress(in AchievementEvaluationContext context)
    Parameters
    Type Name Description
    AchievementEvaluationContext context
    Returns
    Type Description
    AchievementConditionProgress

    IsMet(in AchievementEvaluationContext)

    Declaration
    public override bool IsMet(in AchievementEvaluationContext context)
    Parameters
    Type Name Description
    AchievementEvaluationContext context
    Returns
    Type Description
    bool

    Validate()

    Declaration
    public override string Validate()
    Returns
    Type Description
    string
    In this article
    © 2026 Serenity. All Rights Reserved