Class PlaceableSequence
- Namespace
- MoonBark.GridPlacement.Core.Catalog
- Assembly
- MoonBark.GridPlacement.Core.dll
Represents an ordered sequence of placeables, typically used as an upgrade path where each tier is a distinct PlaceableEntry.
public class PlaceableSequence
- Inheritance
-
PlaceableSequence
- Inherited Members
Constructors
PlaceableSequence(string, string, IEnumerable<PlaceableEntry>)
Creates a new placeable sequence.
public PlaceableSequence(string id, string category, IEnumerable<PlaceableEntry> tiers)
Parameters
idstringUnique identifier for this sequence.
categorystringCategory for filtering.
tiersIEnumerable<PlaceableEntry>Ordered list of placeable tiers (must have at least one).
Exceptions
- ArgumentNullException
If tiers is null.
- ArgumentException
If tiers is empty.
Properties
Category
Category used when grouping or filtering this sequence alongside other placeables in a catalog (for example, "buildings").
public string Category { get; }
Property Value
FirstTier
Gets the first tier (base level).
public PlaceableEntry FirstTier { get; }
Property Value
Id
Unique identifier for this sequence.
public string Id { get; }
Property Value
LastTier
Gets the last tier (max upgrade).
public PlaceableEntry LastTier { get; }
Property Value
TierCount
Number of tiers in this sequence.
public int TierCount { get; }
Property Value
Tiers
Ordered list of placeable tiers, from base to highest tier. The collection is read-only.
public IReadOnlyList<PlaceableEntry> Tiers { get; }
Property Value
Methods
GetTier(int)
Gets the tier at the specified index.
public PlaceableEntry GetTier(int index)
Parameters
indexintZero-based tier index.
Returns
- PlaceableEntry
The placeable entry at that tier.
Exceptions
- ArgumentOutOfRangeException
If index is out of range.
TryGetTier(int, out PlaceableEntry?)
Tries to get the tier at the specified index.
public bool TryGetTier(int index, out PlaceableEntry? tier)
Parameters
indexintZero-based tier index.
tierPlaceableEntryThe tier if found, null otherwise.
Returns
- bool
True if the tier exists, false otherwise.