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.
- Listed in Stats, effects, heat and liquid
- Inherits or implements
PooledObject
Constructors
| Member | What it is |
|---|---|
BoilingParticles() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private ParticleSystem[] boilingParticles | The particle systems this controls. |
private float[] boilingParticlesBaseEmissionValues | Each particle system's emission rate from the prefab. |
private ILiquidContainer container | The liquid container this is attached to. |
private NetworkEntity entity | The container's entity. |
private static BoilingParticlesMaterialCreator materialCreator | Shared creator for the tinted particle materials. |
private Dictionary<ParticleSystem, Material> materialTemplates | Original material of each particle system, used as the template. |
private MaterialPropertyBlock propertyBlock | Property block holding colour and transparency. |
private CookingLiquidVisual.BoilingParticlesStageSetting[] stageSettings | Lifetime and height offset per content level. |
Methods
| Member | What 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
| Member | What 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: