Skip to main content

ClusterGenerator

A class in Root.Township, Alta.Caves.Displays.

Generated network behaviour that spawns a random number of child prefabs around itself and adds them to a Cluster. Server side, saved as children.

Constructors​

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

Fields​

5 private and internal fields
MemberWhat it is
private Cluster clusterThe cluster the spawned children are added to.
private bool isGeneratingFirstTimeBacking field for IsGeneratingFirstTime.
private static Logger loggerNLog logger for this class.
private ObjectPipeline prefabObject pipeline that picks the networked prefab to spawn.
private ClusterSettings settingsCluster settings: child count curve and how children are placed.

Properties​

MemberWhat it is
protected override bool IsGeneratingFirstTime { get; }Returns isGeneratingFirstTime, so whether it generates on first spawn is set per prefab.

Methods​

MemberWhat it is
protected override void Generate(SpawnData spawnData)Spawns a count of prefabs picked from the settings curve, positions each with the settings and adds them to the cluster.
2 private and internal methods
MemberWhat it is
private void OnDrawGizmos()Editor: draws the cluster's offset radius as a red wire sphere.
private void PositionChild(NetworkEntity child)Places a spawned child using the cluster settings.