Skip to main content

FireParticleDivergence

A class in Root.Township, the global namespace.

Pushes fire particles sideways and shortens their life when they enter the particle system's first trigger collider, so flames part around an object.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private Collider divergenceColliderCollider particles diverge from. Overwritten with the trigger module's first collider on enable.
private List<ParticleSystem.Particle> enterReused list of particles that entered the trigger this frame.
private float lifeTimeReductionDivisor for an entering particle's remaining lifetime. Default 1.1.
private float maxForceCap on the push velocity, also used when a particle is exactly on the collider's axis.
private ParticleSystem particleSystemThe particle system on this object.
private float pushForceScale for the push velocity.
private float radiusScale for the push, divided by the particle's offset from the collider.

Methods​

3 private and internal methods
MemberWhat it is
private void HandleEnteredParticles(int numberOfParticlesEntered)Sets each entering particle's horizontal velocity away from the collider and divides its remaining lifetime by lifeTimeReduction.
private void OnEnable()Caches the particle system and takes the collider from its trigger module.
private void OnParticleTrigger()Unity callback: gets entering particles, adjusts them and writes them back.