logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class SequenceCondition

    Met once every step has been met, in the order they were authored.

    Inheritance
    object
    CompositeAchievementCondition
    SequenceCondition
    Inherited Members
    CompositeAchievementCondition.MinimumChildren
    CompositeAchievementCondition.ChildrenFieldName
    CompositeAchievementCondition.Validate()
    CompositeAchievementCondition.CaptureState()
    CompositeAchievementCondition.RestoreState(string)
    CompositeAchievementCondition.CollectSignalTypeNames(ICollection<string>)
    CompositeAchievementCondition.AnyChild(Func<AchievementCondition, bool>)
    CompositeAchievementCondition.Conditions
    CompositeAchievementCondition.Children
    CompositeAchievementCondition.NeedsTick
    Namespace: Serenity.Achievements.Infrastructure.Conditions
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    [AchievementConditionCategory(AchievementConditionCategory.Logic)]
    public class SequenceCondition : CompositeAchievementCondition
    Remarks

    The step the sequence is waiting on is the only one it ever evaluates. When ResetOnOutOfOrder is on, a later step being triggered while an earlier one is still outstanding throws the run away — that is what makes "enter the back room, then leave it, without being spotted in between" a different rule from "do both, in any order".

    "Triggered" is deliberately narrower than "met": a later step counts as out of order only when the signal that caused this evaluation is one the step listens for. The sequence never calls IsMet(in AchievementEvaluationContext) on a step it is not waiting on, because that is not a question — it is an instruction to count, and a later duration or accumulation would quietly build up progress for a run that has not started. The consequence is that a later step which advances only with time (a duration, an accumulation over a score metric) can never trigger a restart; only a signal can.

    Constructors

    SequenceCondition()

    Creates an empty sequence, as Unity's polymorphic serializer does.

    Declaration
    public SequenceCondition()

    SequenceCondition(params AchievementCondition[])

    Creates a sequence over the given steps.

    Declaration
    public SequenceCondition(params AchievementCondition[] steps)
    Parameters
    Type Name Description
    AchievementCondition[] steps

    The steps, in the order they must be met.

    SequenceCondition(bool, params AchievementCondition[])

    Creates a sequence over the given steps.

    Declaration
    public SequenceCondition(bool resetOnOutOfOrder, params AchievementCondition[] steps)
    Parameters
    Type Name Description
    bool resetOnOutOfOrder

    Whether an out-of-order step restarts the sequence.

    AchievementCondition[] steps

    The steps, in the order they must be met.

    Properties

    CompletedStepCount

    How many steps have been met so far.

    Declaration
    public int CompletedStepCount { get; }
    Property Value
    Type Description
    int

    DisplayName

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

    PersistsState

    Always persists: the sequence's own position is the whole point of it, and a rule that forgot which step it was on would demand the entire chain in one session.

    Declaration
    public override bool PersistsState { get; }
    Property Value
    Type Description
    bool
    Overrides
    CompositeAchievementCondition.PersistsState

    ResetOnOutOfOrder

    Whether an out-of-order step restarts the sequence.

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

    Steps

    The steps, in the order they must be met.

    Declaration
    public IReadOnlyList<AchievementCondition> Steps { get; }
    Property Value
    Type Description
    IReadOnlyList<AchievementCondition>

    Methods

    CaptureOwnState()

    The composite's own counter, for a composite that keeps one. Null by default.

    Declaration
    protected override string CaptureOwnState()
    Returns
    Type Description
    string
    Overrides
    CompositeAchievementCondition.CaptureOwnState()

    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
    CompositeAchievementCondition.Reset()

    RestoreOwnState(string)

    Restores the position, clamped to the steps that actually exist. A stored index arrives from a store and may have been written when the sequence had more steps than it has now, so anything past the end is treated as "finished" rather than as an index to walk off.

    Declaration
    protected override void RestoreOwnState(string ownState)
    Parameters
    Type Name Description
    string ownState

    The position previously captured.

    Overrides
    CompositeAchievementCondition.RestoreOwnState(string)
    In this article
    © 2026 Serenity. All Rights Reserved