void initialize()
{
_particleEmitters.Clear();
_particleSystems.Clear();
_forceFlowParticles.Clear();
foreach(GameObject go in elements)
{
foreach(ParticleEmitter pe in go.GetComponentsInChildren<ParticleEmitter>())
{
if(pe.gameObject.activeSelf && pe.enabled)
{
_particleEmitters.Add(pe);
}
}
foreach(ParticleSystem ps in go.GetComponentsInChildren<ParticleSystem>())
{
if(ps.gameObject.activeSelf)
{
ParticleSystem.EmissionModule em = ps.emission;
if(em.enabled)
{
_particleSystems.Add(ps);
}
}
}
foreach(ForceFlowParticle ffp in go.GetComponentsInChildren<ForceFlowParticle>())
{
if(ffp.gameObject.activeSelf && ffp.enabled)
{
_forceFlowParticles.Add(ffp);
}
}
}
_initialized = true;
// switchOff contains a call to initialize conditioned by _initialized,
// therefore _initialized is set to true before the call to switchOff.
switchOff();
allSectors.Add(this);
}