Skip to main content

LinearPartClonerPart

A class in Root.Township, the global namespace.

Generation part that works out how many repeated parts fit along a forest path edge and tells its linear cloners to spawn that many.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private float baseInsetLength taken off per cloner before fitting parts.
private float baseLengthFixed length per cloner before the repeated parts.
private List<LinearPartCloner> clonersCloners in the prefab told directly how many parts to spawn.
private List<SpawnerPart> clonerSpawnerSpawners whose spawned objects hold the cloners, used when cloners is empty.
private float partLengthLength of one repeated part.
private int partsNumber of parts each cloner spawns.
private PathEndsPart pathEndsPartOptional part whose end distance is set so the run is centred.

Methods​

MemberWhat it is
override void GenerateDynamic(GenerationCore core)Tells the cloner on each spawner's last spawned object to spawn the counted parts.
override void GenerateStatic(GenerationCore core, bool isModifyingTerrain)Runs Process with the number of cloners, or of cloner spawners if there are no cloners.
1 private and internal method
MemberWhat it is
private void Process(GenerationCore core, int count)From the edge length, takes off the base length and inset per cloner and divides the rest by partLength. Also centres pathEndsPart.