Skip to main content

AttributeSet

A class in Root.Township, the global namespace.

Biome attribute values (such as for spawning) with an optional parent set to fall back on. Unset values are rolled from the attribute's default range on first read.

Constructors​

MemberWhat it is
AttributeSet(AttributeSet parent)Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

1 private and internal field
MemberWhat it is
private Dictionary<BiomeAttribute, float> attributesThis set's own attribute values. Missing ones fall back to the parent, or are rolled from the attribute's default range and stored.

Properties​

MemberWhat it is
AttributeSet Parent { get; private set; }The set to fall back on.

Methods​

MemberWhat it is
float Get(BiomeAttribute attribute, Random random = null)Returns the value here, else the parent's; with no parent, rolls one in the default range and stores it.
IEnumerator<KeyValuePair<BiomeAttribute, float>> GetEnumerator() (iterator)Lists values set here, then the parent's values not overridden here.
bool IsSet(BiomeAttribute attribute, bool isIncludingParent = true)Whether the attribute has a value here (or in a parent, by default).
void Set(BiomeAttribute attribute, float value)Sets a value in this set.
void SetParent(AttributeSet parent)Changes the parent set.
1 private and internal method
MemberWhat it is
private IEnumerator System.Collections.IEnumerable.GetEnumerator()Lists values set here, then the parent's values not overridden here.

Used in​

Members of other types that take, return or hold a AttributeSet: