Distribution
A class in Root.Township, Alta.Caves.
Weighted random table of assets (prefabs, presets, liquids) under the hashed path Distributions. Item weights can depend on spawn attributes, and festivity groups add items while a festivity is active.
- Listed in World generation
- Inherits or implements
Distribution<Distribution, Object, Distribution.Item, Distribution.FestivityGroup> - Derived types
Distribution,Distribution.Create,Distribution.FestivityGroup,Distribution.Item - Nested types
Create,FestivityGroup,Item - Attributes
HashedPath - Documented in Caves
Constructors
| Member | What it is |
|---|---|
Distribution() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Methods
| Member | What it is |
|---|---|
T GetRandomAs<T>(AttributeSet attributes = null) | Picks a random entry, weighted by the given attributes, and casts it. Null on the null chance, no match or wrong type. |
T GetRandomAs<T>(Func<double> randomValue, AttributeSet attributes = null) | Picks a random entry, weighted by the given attributes, and casts it. Null on the null chance, no match or wrong type. |
protected override void OnValidate() | Logs errors for empty entries and empty festivity groups. |
Used in
Members of other types that take, return or hold a Distribution:
GameObjectDistribution.MigrateToStaticEnvironmentPiece, LiquidContainer.liquidDistribution, PopulationDefinition.distribution, TreeSpecies.stick, TreeSpecies.Stick, TreeSpecies.wedge, TreeSpecies.Wedge, WoodcutTree.spawnDistribution, BiomeSphereGenerator.distribution, MultipleSpawner.SimpleSpawner.distribution, MultipleSpawner.SimpleSpawner.Distribution, MultiSpawner.distributions, MultiSpawner.Distributions, MultiSpawner.SpawnDistribution, PhysicalMaterialPart.materialDistribution, PostboxSender.giftPrefabDistribution, PouchSpawner.distribution, RandomSpawnRectangle.distribution, RandomSpawnRectangleSaveData.distribution, SpawnBuried.spawnDistribution, SpawnBuriedSaveData.distribution, Spawner.distribution.