Skip to main content

BoilingParticles

A class in Root.Township, Alta.Liquid.

Pooled boiling bubble particles for a cooking liquid container. Client visual: tints to the liquid and changes lifetime and height with content level.

Constructors​

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

Fields​

8 private and internal fields
MemberWhat it is
private ParticleSystem[] boilingParticlesThe particle systems this controls.
private float[] boilingParticlesBaseEmissionValuesEach particle system's emission rate from the prefab.
private ILiquidContainer containerThe liquid container this is attached to.
private NetworkEntity entityThe container's entity.
private static BoilingParticlesMaterialCreator materialCreatorShared creator for the tinted particle materials.
private Dictionary<ParticleSystem, Material> materialTemplatesOriginal material of each particle system, used as the template.
private MaterialPropertyBlock propertyBlockProperty block holding colour and transparency.
private CookingLiquidVisual.BoilingParticlesStageSetting[] stageSettingsLifetime and height offset per content level.

Methods​

MemberWhat it is
void ClearParticles()Clears all the particle systems.
override void Release()Unhooks from the container and returns to the pool. The entity check is inverted, so the destroy handler is never removed.
void SetupForContainer(ILiquidContainer container, CookingLiquidVisual.BoilingParticlesStageSetting[] stageSettings)Attaches to a liquid container: hooks its destroy and content level events, applies the liquid look and clears particles.
void SetupForLiquid(LiquidData liquid)Applies a liquid's tinted colour and transparency to the particle materials.
void UpdateEmissionBasedOnTemperature(float temperature, float emissionMultiplier)Sets each emission rate to its base times the multiplier. The temperature argument is not used.
4 private and internal methods
MemberWhat it is
private void Awake()Stores each particle system's material and base emission rate.
private void ReleaseOnDestroy(NetworkEntity entity, bool isUnload)Releases the particles when the container's entity is destroyed.
private void SetupBoilingParticles()Records each particle system's base emission rate.
private void UpdateParticleLifetimesBaseOnContentLevel(ILiquidContainer container, int oldLevel, int newLevel)Picks the stage setting for the content level and sets particle lifetime and parent height from it.

Used in​

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