Skip to main content

Element

A class in Root.Township, Alta.Caves.

A cave generation element asset: a map chunk display prefab chosen by how well it suits a set of attributes, plus named variables.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private AttributeCurveRange[] attributeWeightingsAttribute curves used by GetEfficiency to weight this element against an attribute set.
private float curvelessEfficiencyEfficiency meant for when no curves are set. Not read by this class in this build.
private MapChunkDisplay prefabBacking field for Prefab, the map chunk display spawned for this element.
private List<Element.SerializedVariable> serializedVariablesName and value pairs Unity saves in place of the variables dictionary.
private Dictionary<string, GeneralValue> variablesBacking field for Variables, named general values for this element.

Properties​

MemberWhat it is
MapChunkDisplay Prefab { get; }The map chunk display prefab for this element.
Dictionary<string, GeneralValue> Variables { get; }Named values set on the element.

Methods​

MemberWhat it is
float GetEfficiency(AttributeSet attributes)How well this element suits the given attributes, from its weighting curves.
2 private and internal methods
MemberWhat it is
private void UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()Rebuilds the variables dictionary from the serialized list.
private void UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize()Copies the variables dictionary into the serialized list so Unity can save it.

Used in​

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