Skip to main content

BiomeSphereManager

A class in Root.Township, the global namespace.

Holds a forest's biome spheres and answers which biome a point belongs to. Owned by the forest generation (ForestGeneration.BiomeSphereManager).

Constructors​

MemberWhat it is
BiomeSphereManager()Creates a BiomeSphereManager with default values.

Fields​

3 private and internal fields
MemberWhat it is
private BiomeSphereGenerator generatorSerialized reference to a BiomeSphereGenerator. Not read in this class.
private Dictionary<ForestBiome, List<BiomeSphere>> sortedSpheres grouped by biome, for the filtered GetBiome.
private List<BiomeSphere> spheresBacking list for Spheres.

Properties​

MemberWhat it is
IEnumerable<BiomeSphere> Spheres { get; }All registered spheres.

Methods​

MemberWhat it is
void DrawGizmos()Draws each sphere as a wire sphere in its biome's colour.
BiomeSphere GetBiome(SimplexNoise noise, Random random, Vector3 location, out float bestScore)Returns the sphere scoring highest at a point, from distance to its centre and the biome's noise score. One overload limits it to some biomes.
BiomeSphere GetBiome(SimplexNoise noise, Random random, Vector3 location, IEnumerable<ForestBiome> options, out float bestScore)Returns the sphere scoring highest at a point, from distance to its centre and the biome's noise score. One overload limits it to some biomes.
void Register(BiomeSphere sphere)Adds a sphere to the list and to the per-biome lookup.
void Serialize(Stream stream)Writes or reads the sphere list to a stream. Reading registers each sphere.

Used in​

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