public void Update() { LightFx.intensity -= 12 * Time.deltaTime; if (TimeIndex > 0.2f) { IEnumerator <KSPParticleEmitter> pe = PEmitters.AsEnumerable().GetEnumerator(); while (pe.MoveNext()) { if (pe.Current == null) { continue; } pe.Current.emit = false; } pe.Dispose(); } if (ExplosionEvents.Count == 0 && TimeIndex > 2f * MaxTime) { if (BDArmorySettings.DRAW_DEBUG_LABELS) { Debug.Log( "[BDArmory]:Explosion Finished"); } ExplosionsLoaded.Dequeue(); Destroy(gameObject); return; } }
private void OnEnable() { StartTime = Time.time; LifeTime = Mathf.Clamp(Atmosphere, 0.04f, 1) * 5; PEmitters = gameObject.GetComponentsInChildren <KSPParticleEmitter>(); using (var pe = PEmitters.AsEnumerable().GetEnumerator()) while (pe.MoveNext()) { if (pe.Current == null) { continue; } EffectBehaviour.AddParticleEmitter(pe.Current); pe.Current.emit = true; pe.Current.maxEnergy = Mathf.Clamp(Atmosphere, 0.01f, 1) * 7; pe.Current.minEnergy = Mathf.Clamp(Atmosphere, 0.01f, 1) * 5; pe.Current.maxSize = 400 * (((Yield / 2) + 1) * Mathf.Clamp(Atmosphere, 0.2f, 1)); pe.Current.minSize = 400 * (((Yield / 2) + 1) * Mathf.Clamp(Atmosphere, 0.2f, 1)); } LightFx = gameObject.GetComponent <Light>(); LightFx.color = XKCDColors.Ecru; LightFx.intensity = 3; LightFx.range = 100 * Yield; LightFx.shadows = LightShadows.None; emittersOff = false; transform.position = Position; }
private void Start() { StartTime = Time.time; MaxTime = (Range / ExplosionVelocity) * 3f; CalculateBlastEvents(); PEmitters = gameObject.GetComponentsInChildren <KSPParticleEmitter>(); IEnumerator <KSPParticleEmitter> pe = PEmitters.AsEnumerable().GetEnumerator(); while (pe.MoveNext()) { if (pe.Current == null) { continue; } EffectBehaviour.AddParticleEmitter(pe.Current); pe.Current.emit = true; if (pe.Current.maxEnergy > particlesMaxEnergy) { particlesMaxEnergy = pe.Current.maxEnergy; } } pe.Dispose(); LightFx = gameObject.AddComponent <Light>(); LightFx.color = Misc.Misc.ParseColor255("255,238,184,255"); LightFx.intensity = 8; LightFx.range = Range * 3f; LightFx.shadows = LightShadows.None; if (BDArmorySettings.DRAW_DEBUG_LABELS) { Debug.Log( "[BDArmory]:Explosion started tntMass: {" + Power + "} BlastRadius: {" + Range + "} StartTime: {" + StartTime + "}, Duration: {" + MaxTime + "}"); } }
public void Update() { if (Atmosphere >= 0.25) { LightFx.range -= 20 * Time.deltaTime; LightFx.intensity -= 1 * Time.deltaTime; } else { if (TimeIndex > 0.05) { LightFx.range -= 1300 * Time.deltaTime; LightFx.intensity = 0; } } if (TimeIndex > 0.2f && !emittersOff) { IEnumerator <KSPParticleEmitter> pe = PEmitters.AsEnumerable().GetEnumerator(); while (pe.MoveNext()) { if (pe.Current == null) { continue; } pe.Current.emit = false; EffectBehaviour.RemoveParticleEmitter(pe.Current); emittersOff = true; } pe.Dispose(); } else if (TimeIndex > LifeTime) { gameObject.SetActive(false); return; } }