Skip to main content

ImpactorMap

A class in Root.Township, Alta.Impact.

Component on a crafting part that maps each of its colliders to the ImpactGenerators under it. Used by ImpactTool and ImpactModifier when parts are joined into a tool.

Constructors​

MemberWhat it is
ImpactorMap()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

2 private and internal fields
MemberWhat it is
private ImpactorMap.MapElement[] elementsSerialized pairs of a collider and the impact generators under it. Filled automatically by OnValidate when empty.
private Dictionary<Collider, HashSet<ImpactGenerator>> mapBacking field for Map, built from elements the first time it's read.

Properties​

MemberWhat it is
Dictionary<Collider, HashSet<ImpactGenerator>> Map { get; }Collider to impact generator lookup, built from the serialized elements on first use.
IEnumerable<ImpactGenerator> OrderedImpactors { get; }Every impact generator in the map, in serialized order. Can repeat a generator listed under several colliders.

Methods​

MemberWhat it is
void ForceValidate()Clears and rebuilds the collider map from the children, logging an error.
void OnValidate()Editor: builds the serialized map from child colliders and their impact generators if it is empty.
bool Test()Builds the map if it is empty and returns true when it had to. Logs an error if nothing was found.

Used in​

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