Skip to main content

EmberComposerFireEffect

A class in Root.Township, the global namespace.

Pooled fire effect used by the EmberComposer skill: particle systems plus a light that fades in when lit and fades out on release.

Constructors​

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

Fields​

10 private and internal fields
MemberWhat it is
private float baseIntensityLight intensity from the prefab.
private bool isLitBacking field for IsLit.
private AnimationCurve lightEndMultiplierLight curve used when not lit.
private AnimationCurve lightStartMultiplierLight curve used when lit.
private Coroutine litCoroutineThe running light fade.
private float multiplierBacking field for Multiplier.
private ParticleSystem[] systemsChild particle systems.
private Dictionary<ParticleSystem, float> systemsInitialSystemsEach system's original start speed, used by SetSize.
private PlatformLight targetLight whose intensity is driven.
private float unmultipliedIntensityLight intensity from the curve before Multiplier.

Properties​

MemberWhat it is
float Duration { get; private set; }Longest particle start lifetime of the systems, worked out in Awake.
bool IsLit { get; set; }Setting it true plays the particles and restarts the light fade.
float Multiplier { get; set; }Extra scale on the light intensity; setting it applies at once.

Methods​

MemberWhat it is
override void Release()Unparents the effect, stops emitting, stops the light fade and starts the delayed release.
void SetSize(float size)Scales each system's start speed by size and lights the effect.
9 private and internal methods
MemberWhat it is
private void Awake()Records the light intensity and each system's start speed, and sets Duration to the longest particle lifetime.
private IEnumerator DelayRelease() (iterator)Fades the light multiplier to zero over Duration, waits Duration more for particles to die, then returns to the pool.
private IEnumerator FadeLight() (iterator)Coroutine that runs the start or end light curve from the point matching the current intensity.
private float FindClosestTime(AnimationCurve curve, float value, int steps)Samples a curve in steps and returns the time whose value is closest to the given one.
private void OnDisable()Empty.
private void Play()Plays every particle system, without children.
private void IBuildRendererPostBake.PostBake()Build step that removes null entries from systems.
private void RequestedStart(PooledObject pooledObject)Enables the component when taken from the pool.
private void Reset()Sets the multiplier to 1 and turns the light off.