private static int set_autodestruct(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; bool autodestruct = LuaDLL.luaL_checkboolean(L, 2); particleAnimator.set_autodestruct(autodestruct); result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index autodestruct on a nil value"); } return(result); }
private void killCurrentEffects() { ParticleEmitter[] componentsInChildren = base.get_transform().GetComponentsInChildren <ParticleEmitter>(); ParticleEmitter[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { ParticleEmitter particleEmitter = array[i]; Debuger.Info("resetEffect killing: " + particleEmitter.get_name(), new object[0]); ParticleAnimator component = particleEmitter.get_transform().GetComponent <ParticleAnimator>(); if (component != null) { component.set_autodestruct(true); } Particle[] particles = particleEmitter.get_particles(); for (int j = 0; j < particles.Length; j++) { particles[j].set_energy(0.1f); } particleEmitter.set_particles(particles); } }
private void SpawnEffect() { GameObject gameObject; if (this.m_ParticlePrefab != null) { gameObject = base.CreateGameObject(this.m_ParticlePrefab); if (gameObject == null) { return; } base.ChangeParent(base.get_transform(), gameObject.get_transform(), true, null); } else { gameObject = base.get_gameObject(); } ParticleEmitter component = gameObject.GetComponent <ParticleEmitter>(); if (component == null) { return; } component.set_emit(false); component.set_useWorldSpace(false); ParticleAnimator component2 = component.get_transform().GetComponent <ParticleAnimator>(); if (component2 != null) { component2.set_autodestruct(true); } component.Emit(this.m_nNumberOfArms * this.m_nParticlesPerArm); Particle[] particles = component.get_particles(); float num = 6.28318548f / (float)this.m_nNumberOfArms; for (int i = 0; i < this.m_nNumberOfArms; i++) { float num2 = 0f; float num3 = (float)i * num; for (int j = 0; j < this.m_nParticlesPerArm; j++) { int num4 = i * this.m_nParticlesPerArm + j; float num5 = this.m_fOriginOffset + this.m_fTurnDistance * num2; Vector3 vector = gameObject.get_transform().get_localPosition(); vector.x += num5 * Mathf.Cos(num2); vector.z += num5 * Mathf.Sin(num2); float x = vector.x * Mathf.Cos(num3) + vector.z * Mathf.Sin(num3); float z = -vector.x * Mathf.Sin(num3) + vector.z * Mathf.Cos(num3); vector.x = x; vector.z = z; vector.y += (float)j * this.m_fVerticalTurnDistance; if (component.get_useWorldSpace()) { vector = base.get_transform().TransformPoint(vector); } particles[num4].set_position(vector); num2 += this.m_fParticleSeparation; if (this.m_fFadeValue != 0f) { particles[num4].set_energy(particles[num4].get_energy() * (1f - Mathf.Abs(this.m_fFadeValue)) + particles[num4].get_energy() * Mathf.Abs(this.m_fFadeValue) * (float)((this.m_fFadeValue >= 0f) ? (j + 1) : (this.m_nParticlesPerArm - j)) / (float)this.m_nParticlesPerArm); } if (this.m_fSizeValue != 0f) { Particle[] expr_276_cp_0 = particles; int expr_276_cp_1 = num4; expr_276_cp_0[expr_276_cp_1].set_size(expr_276_cp_0[expr_276_cp_1].get_size() + Mathf.Abs(this.m_fSizeValue) * (float)((this.m_fSizeValue >= 0f) ? (j + 1) : (this.m_nParticlesPerArm - j)) / (float)this.m_nParticlesPerArm); } } } component.set_particles(particles); }