lib-unity-tutorial-gameplay-Assets-Scripts-Effects-SpecialEffectHandler.js / js
// Helper script to toggle the emit property of many particle systems. // It's attached to the root Game Object of a hierarcy. Then calling SetSpecialEffectActive will // enable or disable all particle systems in transform children. // helper variable to track if the particles are already on. private var effectActive : boolean; function SetSpecialEffectActive (on : boolean) { // Only do something if we're actually changing the effects being on or off if (on != effectActive) { // Find a list of all ParticleEmitters that are in this object's transform children var childEmitters = GetComponentsInChildren(ParticleEmitter); // Go over all them for (var emitter in childEmitters) { // turn them on or off emitter.emit = on; } effectActive = on; } }
(C) Æliens 04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.