Skip to main content

TemperatureVisuals

A class in Root.Township, the global namespace.

Drives a smelter-style fire's look from its temperature: light faders, coal glow and two particle sets. Client only (skipped on a headless server); Recycler calls UpdateVisuals.

Constructors​

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

Fields​

11 private and internal fields
MemberWhat it is
private static readonly int _EmissionColorShader property ID for _EmissionColor.
private Renderer[] coalsCoal renderers that glow with heat.
private AnimationCurve coalsBrightnessCurve from heat to coal emission brightness.
private Material coalsMaterialShared material copy for all coal renderers.
private bool isPlayingParticlesNot used; each particle handler tracks its own playing state.
private LightFader[] lightFadersLights that fade with heat.
private float maximumLightLight multiplier at full heat.
private float minimumLightLight multiplier at the lowest heat, and when cold.
private Coroutine particlesStoppingCoroutineNot used; each particle handler keeps its own stop coroutine.
private TemperatureVisuals.ParticleSystemHandler pushParticlesParticles driven by the push value (probably when the bellows are pumped).
private TemperatureVisuals.ParticleSystemHandler stableParticlesParticles driven by the steady heat value.

Methods​

MemberWhat it is
void UpdateVisuals(float value, float pushValue)Updates lights, coals and stable particles from the heat value, and the push particles from the push value (both 0 to 1).
6 private and internal methods
MemberWhat it is
private void Awake()Client: makes one material copy for the coals and puts it on every coal renderer.
private void OnDestroy()Cleans up the coals material copy.
private void IBuildRendererPostBake.PostBake()Build step: strips missing particle systems and coal renderers from the arrays.
private void Start()Client: sets up both particle handlers and shows the cold state.
private void UpdateCoals(float lightProgress)Sets the coals' emission colour from the brightness curve at the given heat.
private void UpdateLightFader(float lightProgress)Turns the light faders on above zero heat and scales them between the minimum and maximum light.

Used in​

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