logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Struct AchievementEvaluationContext

    Everything a condition tree is allowed to read during one evaluation: the score metrics, the global progress, how much time passed, the signal that caused the evaluation, and the resolver a CustomCondition reaches its project-supplied rule through.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Serenity.Achievements.Application.Conditions
    Assembly: Serenity.Achievements.Application.dll
    Syntax
    public readonly struct AchievementEvaluationContext
    Remarks

    Passed by in reference so a deep tree costs one copy rather than one per node. Every accessor tolerates an absent source, because the evaluator is built before the services that feed it are guaranteed to be up: a project with no Score service still evaluates its signal and progress conditions instead of failing the whole tree.

    Constructors

    AchievementEvaluationContext(ScoreSnapshot, GameProgressData, float, float, EventDispatcherSignal, IAchievementCustomConditionResolver)

    Creates a new evaluation context.

    Declaration
    public AchievementEvaluationContext(ScoreSnapshot scores, GameProgressData progress, float scaledDeltaSeconds, float unscaledDeltaSeconds, EventDispatcherSignal lastSignal, IAchievementCustomConditionResolver resolver)
    Parameters
    Type Name Description
    ScoreSnapshot scores

    The score metrics at this evaluation.

    GameProgressData progress

    The global game progress at this evaluation. May be null.

    float scaledDeltaSeconds

    Seconds elapsed, affected by the time scale.

    float unscaledDeltaSeconds

    Seconds elapsed, ignoring the time scale.

    EventDispatcherSignal lastSignal

    The signal that caused this evaluation, or null for a tick.

    IAchievementCustomConditionResolver resolver

    Resolves custom conditions. May be null.

    Fields

    LastSignal

    The signal that caused this evaluation, or null when it was a tick.

    Declaration
    public readonly EventDispatcherSignal LastSignal
    Field Value
    Type Description
    EventDispatcherSignal

    Progress

    The global game progress at this evaluation. May be null.

    Declaration
    public readonly GameProgressData Progress
    Field Value
    Type Description
    GameProgressData

    Resolver

    Resolves the project-supplied rule a custom condition names. May be null.

    Declaration
    public readonly IAchievementCustomConditionResolver Resolver
    Field Value
    Type Description
    IAchievementCustomConditionResolver

    ScaledDeltaSeconds

    Seconds elapsed since the previous tick, affected by the game's time scale.

    Declaration
    public readonly float ScaledDeltaSeconds
    Field Value
    Type Description
    float

    Scores

    The score metrics at this evaluation. May carry no metrics at all.

    Declaration
    public readonly ScoreSnapshot Scores
    Field Value
    Type Description
    ScoreSnapshot

    UnscaledDeltaSeconds

    Seconds elapsed since the previous tick, ignoring the game's time scale.

    Declaration
    public readonly float UnscaledDeltaSeconds
    Field Value
    Type Description
    float

    Properties

    ProgressOrEmpty

    The global progress, or brand-new progress when none was supplied.

    Declaration
    public GameProgressData ProgressOrEmpty { get; }
    Property Value
    Type Description
    GameProgressData

    Methods

    IsSignal(string)

    Whether LastSignal is of the named type. The name may be an assembly qualified name, a namespace-qualified full name, or the bare type name.

    Declaration
    public bool IsSignal(string signalTypeName)
    Parameters
    Type Name Description
    string signalTypeName

    The signal type name authored on the condition.

    Returns
    Type Description
    bool
    Remarks

    Authoring stores the assembly qualified name, which pins an assembly version that a rebuild can move. Matching drops everything after the assembly separator for exactly the reason ReflectionActivationUtils.ResolveType falls back past it: an achievement must not stop unlocking because a package version was bumped.

    TryGetScore(ScoreKey, out float)

    Reads a score metric's amount.

    Declaration
    public bool TryGetScore(ScoreKey key, out float amount)
    Parameters
    Type Name Description
    ScoreKey key

    The metric to read.

    float amount

    The amount held for that metric, or zero when it is not tracked.

    Returns
    Type Description
    bool

    True when the metric is tracked; otherwise false.

    TypeNameWithoutAssembly(string)

    The namespace-qualified part of a type name, with the assembly identity dropped. Shared with the evaluator's signal index, so a name authored as an assembly qualified name and a signal arriving as a live type agree on one key.

    Declaration
    public static string TypeNameWithoutAssembly(string typeName)
    Parameters
    Type Name Description
    string typeName

    The type name to trim.

    Returns
    Type Description
    string

    The name up to the assembly separator, trimmed.

    In this article
    © 2026 Serenity. All Rights Reserved