void Awake() { expBool = flrBool = false; systemType = SystemType.None; savedSystemType = SystemType.None; particleSystems = Resources.LoadAll("Explosions", typeof(GameObject)); loadFlareSystems = Resources.LoadAll("Flares", typeof(GameObject)); loadDirectionalSystems = Resources.LoadAll("Directional", typeof(GameObject)); flareSystems = new List <FlareSystem>(); directionalSystems = new List <FlareSystem>(); foreach (Object obj in loadFlareSystems) { FlareSystem thisFlareSystem = new FlareSystem (); thisFlareSystem.name = obj.name; thisFlareSystem.particleObject = Instantiate (obj, Vector3.zero, Quaternion.identity) as GameObject; thisFlareSystem.particleSystems = thisFlareSystem.particleObject.GetComponentsInChildren<ParticleSystem>(); thisFlareSystem.particleObject.SetActive (false); thisFlareSystem.toggleFlag = false; thisFlareSystem.particleObject.transform.parent = this.transform; flareSystems.Add (thisFlareSystem); } foreach (Object obj in loadDirectionalSystems) { FlareSystem thisFlareSystem = new FlareSystem (); thisFlareSystem.name = obj.name; thisFlareSystem.particleObject = Instantiate (obj, Vector3.zero, Quaternion.identity) as GameObject; thisFlareSystem.particleSystems = thisFlareSystem.particleObject.GetComponentsInChildren<ParticleSystem>(); thisFlareSystem.particleObject.SetActive (false); thisFlareSystem.toggleFlag = false; thisFlareSystem.particleObject.transform.parent = this.transform; directionalSystems.Add (thisFlareSystem); } }
void Awake() { expBool = flrBool = false; systemType = SystemType.None; savedSystemType = SystemType.None; particleSystems = Resources.LoadAll("Explosions", typeof(GameObject)); loadFlareSystems = Resources.LoadAll("Flares", typeof(GameObject)); loadDirectionalSystems = Resources.LoadAll("Directional", typeof(GameObject)); flareSystems = new List <FlareSystem>(); directionalSystems = new List <FlareSystem>(); foreach (Object obj in loadFlareSystems) { FlareSystem thisFlareSystem = new FlareSystem(); thisFlareSystem.name = obj.name; thisFlareSystem.particleObject = Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject; thisFlareSystem.particleSystems = thisFlareSystem.particleObject.GetComponentsInChildren <ParticleSystem>(); thisFlareSystem.particleObject.SetActiveRecursively(false); thisFlareSystem.toggleFlag = false; thisFlareSystem.particleObject.transform.parent = this.transform; flareSystems.Add(thisFlareSystem); } foreach (Object obj in loadDirectionalSystems) { FlareSystem thisFlareSystem = new FlareSystem(); thisFlareSystem.name = obj.name; thisFlareSystem.particleObject = Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject; thisFlareSystem.particleSystems = thisFlareSystem.particleObject.GetComponentsInChildren <ParticleSystem>(); thisFlareSystem.particleObject.SetActiveRecursively(false); thisFlareSystem.toggleFlag = false; thisFlareSystem.particleObject.transform.parent = this.transform; directionalSystems.Add(thisFlareSystem); } }
void UpdateEffects(FlareSystem fs, bool toggle) { fs.ParticleObject.SetActive(toggle); if (toggle && fs.IsActive == false) { foreach (ParticleSystem pSys in fs.ParticleSystems) { pSys.Clear(); pSys.Play(); } } fs.IsActive = toggle; }
void SetUpLevel4Effects() { if (Lvl4EffectsObj == null) { return; } _level4FlareSystem = new List <FlareSystem>(); foreach (var pos in Lvl4EffectsLocations) { FlareSystem thisFlareSystem = new FlareSystem(); thisFlareSystem.ParticleObject = Instantiate(Lvl4EffectsObj, pos, Quaternion.identity) as GameObject; thisFlareSystem.ParticleSystems = thisFlareSystem.ParticleObject.GetComponentsInChildren <ParticleSystem>(); thisFlareSystem.ParticleObject.SetActive(false); thisFlareSystem.ParticleObject.transform.parent = this.transform; thisFlareSystem.ParticleObject.transform.localScale = new Vector3(partScale, partScale, partScale); thisFlareSystem.IsActive = false; _level4FlareSystem.Add(thisFlareSystem); } }