Skip to main content

LiquidVisualChunkDefinition

A class in Root.Township, Alta.Cooking.

An asset that spawns floating chunk visuals in a liquid (such as pieces in a stew), with random count and size variation.

Constructors​

MemberWhat it is
LiquidVisualChunkDefinition()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

6 private and internal fields
MemberWhat it is
private float amountVariationRandom variation in the count, as a share of numberPerServing. 0 by default.
private const string AssetPathFormatEditor asset path pattern for chunk definitions. GetOrCreate does nothing in this build.
private int numberPerServingHow many chunk visuals spawn per serving. 3 by default.
private PooledObjectDefinition pooledObjectDefinitionPooled object spawned for each chunk visual.
private float sizeBase scale of each chunk. 1 by default.
private float sizeVariationRandom variation in size, as a share of size. 0.1 by default.

Methods​

MemberWhat it is
static LiquidVisualChunkDefinition GetOrCreate(string name, out bool wasCreated)Editor helper to find or create the asset by name. Returns null in this build.
IEnumerable<PooledObject> SpawnVisuals(Transform targetTransform, float sizeMultiplier) (iterator)Spawns pooled chunk objects under the target, about numberPerServing of them, each scaled by the random size times the multiplier.
1 private and internal method
MemberWhat it is
private float GetValueWithRandomVariation(float value, float variation)Returns the value plus or minus a random share of itself, up to variation.

Used in​

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