logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class CompositeAchievementCondition

    Shared shape of every condition that holds a list of children: the serialized list itself, and the walks that have to visit all of them — reset, validation, signal collection, and the state round trip.

    Inheritance
    object
    CompositeAchievementCondition
    AndCondition
    OrCondition
    SequenceCondition
    Namespace: Serenity.Achievements.Infrastructure.Conditions
    Assembly: Serenity.UnityAchievements.Infrastructure.dll
    Syntax
    public abstract class CompositeAchievementCondition : AchievementCondition
    Remarks

    The list is named conditions on every composite, including SequenceCondition whose children read as steps, so one authoring drawer can bind to one serialized property name rather than one per composite.

    Constructors

    CompositeAchievementCondition()

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

    Declaration
    protected CompositeAchievementCondition()

    CompositeAchievementCondition(IEnumerable<AchievementCondition>)

    Creates a composite over the given children.

    Declaration
    protected CompositeAchievementCondition(IEnumerable<AchievementCondition> children)
    Parameters
    Type Name Description
    IEnumerable<AchievementCondition> children

    The children to combine. Null is treated as empty.

    Fields

    ChildrenFieldName

    The name the child list is serialized under, on every composite. Named here because more than one tool binds to it by string — the authoring drawer, and the recipe importer checking that an authored composite actually declares its children — and a rename that missed one of them would silently stop matching.

    Declaration
    public const string ChildrenFieldName = "conditions"
    Field Value
    Type Description
    string

    MinimumChildren

    How many children a composite needs before combining them means anything. One child is not a combination — it is the child, wearing a wrapper that changes nothing.

    Declaration
    public const int MinimumChildren = 2
    Field Value
    Type Description
    int

    Properties

    Children

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

    Conditions

    The children this node combines. Never null, even when the backing list is.

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

    A composite can reach this class without its field initializer ever having run: a recipe import materializes a [SerializeReference] node through FormatterServices.GetUninitializedObject, and an entry that authors no children leaves the list null rather than empty. Every walk below — and every concrete composite — reads the children through this accessor for that reason, so "no children" is one case here instead of a null check repeated in each of them. Validate still reports the node as under-filled: an empty combination is authored wrong, it just must not be able to throw on the way to saying so.

    NeedsTick

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

    PersistsState

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

    Methods

    AnyChild(Func<AchievementCondition, bool>)

    Whether any child answers true to the given question.

    Declaration
    protected bool AnyChild(Func<AchievementCondition, bool> question)
    Parameters
    Type Name Description
    Func<AchievementCondition, bool> question

    The question to ask of each child.

    Returns
    Type Description
    bool

    CaptureOwnState()

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

    Declaration
    protected virtual string CaptureOwnState()
    Returns
    Type Description
    string

    CaptureState()

    Declaration
    public override string CaptureState()
    Returns
    Type Description
    string

    CollectSignalTypeNames(ICollection<string>)

    Declaration
    public override void CollectSignalTypeNames(ICollection<string> sink)
    Parameters
    Type Name Description
    ICollection<string> sink

    Reset()

    Declaration
    public override void Reset()

    RestoreOwnState(string)

    Restores the composite's own counter.

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

    The counter previously produced by CaptureOwnState().

    RestoreState(string)

    Declaration
    public override void RestoreState(string state)
    Parameters
    Type Name Description
    string state

    Validate()

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