logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AccumulateWhileCondition

    Met once enough of something has accumulated while the condition it wraps held. The something is either the growth of a score metric or a flat rate per second.

    Inheritance
    object
    SingleChildAchievementCondition
    AccumulateWhileCondition
    Inherited Members
    SingleChildAchievementCondition.ChildFieldName
    SingleChildAchievementCondition.Validate()
    SingleChildAchievementCondition.CaptureState()
    SingleChildAchievementCondition.RestoreState(string)
    SingleChildAchievementCondition.CollectSignalTypeNames(ICollection<string>)
    SingleChildAchievementCondition.CaptureOwnState()
    SingleChildAchievementCondition.RestoreOwnState(string)
    SingleChildAchievementCondition.Child
    SingleChildAchievementCondition.Children
    SingleChildAchievementCondition.PersistsState
    Namespace: Serenity.Achievements.Infrastructure.Conditions
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    [AchievementConditionCategory(AchievementConditionCategory.Metrics)]
    public class AccumulateWhileCondition : SingleChildAchievementCondition
    Remarks

    This is the "travel a hundred metres without touching the ground" shape: distance is already a metric the game feeds, and the rule is how much of it accrued while airborne. Only the growth counts, never the metric's absolute value — otherwise a player who had already walked a kilometre would earn it on their first jump.

    The accumulator does not persist. Breaking the wrapped condition resets it by default, and a relaunch is the largest possible break: carrying a partial run across it would credit a continuity the player never had.

    Constructors

    AccumulateWhileCondition()

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

    Declaration
    public AccumulateWhileCondition()

    AccumulateWhileCondition(AchievementCondition, float, string, float, bool)

    Creates a condition accumulating while another holds.

    Declaration
    public AccumulateWhileCondition(AchievementCondition inner, float requiredAmount, string sourceScoreKey = null, float ratePerSecond = 0, bool resetOnBreak = true)
    Parameters
    Type Name Description
    AchievementCondition inner

    The condition that has to hold.

    float requiredAmount

    How much has to accumulate.

    string sourceScoreKey

    The metric whose growth accumulates, or null for a flat rate.

    float ratePerSecond

    How much accumulates per second when no metric is named.

    bool resetOnBreak

    Whether a break throws the accumulated amount away.

    Properties

    AccumulatedAmount

    How much has accumulated so far.

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

    DisplayName

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

    MissingChildMessage

    What this node reports when it wraps nothing at all.

    Declaration
    protected override string MissingChildMessage { get; }
    Property Value
    Type Description
    string
    Overrides
    SingleChildAchievementCondition.MissingChildMessage

    NeedsTick

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

    RatePerSecond

    How much accumulates per second when no source metric is named.

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

    RequiredAmount

    How much has to accumulate.

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

    ResetOnBreak

    Whether a break throws the accumulated amount away.

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

    SourceScoreKey

    The score metric whose growth is accumulated.

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

    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

    Reset()

    Declaration
    public override void Reset()
    Overrides
    SingleChildAchievementCondition.Reset()

    ValidateOwnConfiguration()

    Checks the node's own fields, once the child is known to be present.

    Declaration
    protected override string ValidateOwnConfiguration()
    Returns
    Type Description
    string

    What is wrong, or null when the node's own configuration is valid.

    Overrides
    SingleChildAchievementCondition.ValidateOwnConfiguration()
    In this article
    © 2026 Serenity. All Rights Reserved