PooledFireEffect
A class in Root.Township, the global namespace.
Client: the pooled fire visual for a heat source: particles plus a platform light that fades in when lit and dies down on release.
- Listed in Global namespace: P
- Inherits or implements
PooledObject
Constructors
| Member | What it is |
|---|---|
PooledFireEffect() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
17 private and internal fields
| Member | What it is |
|---|---|
private List<GameObject> aditionalParticleSystems | Extra particle copies made for a FireDissolve's other renderers. |
private float baseIntensity | The light's intensity from the prefab. |
private Dictionary<ParticleSystem, ParticleSystemShapeType> baseShapes | Each particle system's original shape type, restored when not on a FireDissolve. |
private FireSettings currentSettings | The fire settings from the last heat source. |
private bool hasModifiedShapes | True once particle shapes have been changed for a FireDissolve. |
private bool isLit | Backing field for IsLit. |
private bool isWarmedUp | Backing field for IsWarmedUp. |
private AnimationCurve lightEndMultiplier | Curve for the light fading out. |
private AnimationCurve lightStartMultiplier | Curve for the light fading in. |
private Coroutine litCoroutine | The running FadeLight coroutine. |
private float multiplier | Backing field for Multiplier. |
private UnityEvent OnReleased | Unity event run when the effect is released. |
private UnityEvent OnRequested | Unity event run when the effect is taken from the pool. |
private Transform particlesParent | Parent of the fire's particle systems. |
private Dictionary<ParticleSystem, Vector2> systemsInitialSystems | Each particle system's starting emission rate and start size. |
private PlatformLight target | The light the effect controls. |
private float unmultipliedIntensity | Light intensity before Multiplier is applied. |
Properties
Methods
| Member | What it is |
|---|---|
override void Release() | Stops emitting, runs OnReleased and starts DelayRelease instead of releasing at once. |
void UpdateMultiplier(float multiplier) | Scales every particle system's emission rate and start size from their starting values. |
void UpdateProgress(float progress) | Changes light brightness and particle scale from the fire settings' curves at a burn progress. |
virtual void UpdateSettings(HeatSourceBase heatSource) | Applies a heat source's fire settings to the light and particles. For a FireDissolve, copies the particles onto each of its renderers. |
9 private and internal methods
| Member | What it is |
|---|---|
private void ApplySystemsShape(Transform parent, MeshRenderer renderer) | Makes every particle system under a transform emit from a mesh renderer's shape. |
private void Awake() | Records each particle system's emission rate, size, shape and longest lifetime, and turns the light off. |
private IEnumerator DelayRelease() (iterator) | Coroutine that fades the light out, waits for particles to finish, then returns the effect to the pool. |
private IEnumerator FadeLight() (iterator) | Coroutine that runs the light along the start curve (or end curve when unlit) from its current level. |
private float FindClosestTime(AnimationCurve curve, float value, int steps) | Finds the time on a curve whose value is closest to a target, in a set number of steps. |
private void OnDisable() | Empty. |
private void Play() | Plays every particle system. |
private void RequestedStart(PooledObject pooledObject) | Turns the component on and runs OnRequested when taken from the pool. |
private void Reset() | Sets the multiplier to 1 and turns the light off. |
Used in
Members of other types that take, return or hold a PooledFireEffect: