// Property ------------------------------------------------------------------------- // Loop Function -------------------------------------------------------------------- // Control Function ----------------------------------------------------------------- // Particle public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab) { int nIndex = m_SharedPrefabs.IndexOf(originalParticlePrefab); if (nIndex < 0 || m_SharedGameObjects[nIndex] == null) { if (NcEffectBehaviour.IsSafe() == false) { return(null); } GameObject sharedObj = (GameObject)Object.Instantiate(originalParticlePrefab); sharedObj.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform; if (0 <= nIndex) { m_SharedGameObjects[nIndex] = sharedObj; } else { m_SharedPrefabs.Add(originalParticlePrefab); m_SharedGameObjects.Add(sharedObj); } // Init sharedObj NcParticleSystem ps = sharedObj.GetComponent <NcParticleSystem>(); if (ps) { ps.enabled = false; } if (sharedObj.GetComponent <ParticleEmitter>()) { sharedObj.GetComponent <ParticleEmitter>().emit = false; sharedObj.GetComponent <ParticleEmitter>().useWorldSpace = true; ParticleAnimator paAni = sharedObj.GetComponent <ParticleAnimator>(); if (paAni) { paAni.autodestruct = false; } } NcParticleSystem ncPsCom = sharedObj.GetComponent <NcParticleSystem>(); if (ncPsCom) { ncPsCom.m_bBurst = false; } ParticleSystem psCom = sharedObj.GetComponent <ParticleSystem>(); if (psCom) { psCom.enableEmission = false; } return(sharedObj); } else { return(m_SharedGameObjects[nIndex]); } }
public GameObject GetSharedParticleGameObject(GameObject originalParticlePrefab) { int num = this.m_SharedPrefabs.IndexOf(originalParticlePrefab); if (num >= 0 && !(this.m_SharedGameObjects[num] == null)) { return(this.m_SharedGameObjects[num]); } if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(originalParticlePrefab); gameObject.transform.parent = NcEffectBehaviour.GetRootInstanceEffect().transform; if (0 <= num) { this.m_SharedGameObjects[num] = gameObject; } else { this.m_SharedPrefabs.Add(originalParticlePrefab); this.m_SharedGameObjects.Add(gameObject); } NcParticleSystem component = gameObject.GetComponent <NcParticleSystem>(); if (component) { component.enabled = false; } if (gameObject.particleEmitter) { gameObject.particleEmitter.emit = false; gameObject.particleEmitter.useWorldSpace = true; ParticleAnimator component2 = gameObject.GetComponent <ParticleAnimator>(); if (component2) { component2.autodestruct = false; } } NcParticleSystem component3 = gameObject.GetComponent <NcParticleSystem>(); if (component3) { component3.m_bBurst = false; } ParticleSystem component4 = gameObject.GetComponent <ParticleSystem>(); if (component4) { component4.enableEmission = false; } return(gameObject); }
private static int _CreateParticleAnimator(IntPtr L) { if (LuaDLL.lua_gettop(L) == 0) { ParticleAnimator obj = new ParticleAnimator(); LuaScriptMgr.Push(L, obj); return(1); } LuaDLL.luaL_error(L, "invalid arguments to method: ParticleAnimator.New"); return(0); }
void EmitBirds() { Transform birds = Instantiate(birdsPrefab, transform.position, transform.rotation) as Transform; ParticleAnimator animator = birds.GetComponentInChildren <ParticleAnimator>(); animator.force = new Vector3(0, GetRandomInRange(-0.3f, 0.3f), 0); ParticleEmitter emitter = birds.GetComponentInChildren <ParticleEmitter>(); emitter.emit = true; }
private void Start() { #if (UseParticleSystem) // for Perticle System ps_FX = GetComponent <ParticleSystem>(); grad[0] = new Gradient(); grad[0].SetKeys( // Color white, no alpha gradietion. new GradientColorKey[] { // RGB指定。 new GradientColorKey(Color.white, 1.0f), new GradientColorKey(Color.white, 1.0f), new GradientColorKey(Color.white, 1.0f), new GradientColorKey(Color.white, 1.0f), new GradientColorKey(Color.white, 1.0f) }, new GradientAlphaKey[] { // ALPHAグラデーション指定。 new GradientAlphaKey(255 / 255, 0.0f), // Start new GradientAlphaKey(255 / 255, 1.0f) // End } ); grad[1] = new Gradient(); grad[1].SetKeys( // Color red, alpha gradietion. new GradientColorKey[] { // RGB指定。 new GradientColorKey(new Vector4(255, 13, 13) / 255, 0f), // Start new GradientColorKey(new Vector4(176, 86, 255) / 255, 1f / 4f), // 1/4 lapse time. new GradientColorKey(new Vector4(255, 2, 185) / 255, 2f / 4f), // 2/4 lapse time. new GradientColorKey(new Vector4(255, 0, 0) / 255, 3f / 4f), // 3/4 lapse time. new GradientColorKey(new Vector4(255, 28, 202) / 255, 1f) // End }, new GradientAlphaKey[] { // ALPHAグラデーション指定。 new GradientAlphaKey(0 / 255, 0f), new GradientAlphaKey(255 / 255, 1f / 4f), new GradientAlphaKey(16 / 255, 2f / 4f), new GradientAlphaKey(13 / 255, 3f / 4f), new GradientAlphaKey(0 / 255, 1f) } ); #else // for Legacy Perticle pe_FX = GetComponent <ParticleEmitter>(); pa_FX = GetComponent <ParticleAnimator>(); ColorsAnim[0, 0] = Color.white; ColorsAnim[0, 1] = Color.white; ColorsAnim[0, 2] = Color.white; ColorsAnim[0, 3] = Color.white; ColorsAnim[0, 4] = Color.white; ColorsAnim[1, 0] = new Vector4(255, 13, 13, 0) / 255; ColorsAnim[1, 1] = new Vector4(176, 86, 255, 255) / 255; ColorsAnim[1, 2] = new Vector4(255, 2, 185, 16) / 255; ColorsAnim[1, 3] = new Vector4(255, 0, 0, 13) / 255; ColorsAnim[1, 4] = new Vector4(255, 28, 202, 0) / 255; #endif // for Legacy Perticle }
private void Start() { this._ParticleAnimator = base.GetComponent <ParticleAnimator>(); if (this._ParticleAnimator == null) { Debug.Log("Not Found ParticleAnimatior! don't use BlinkScript"); } this._ArryColor = this._ParticleAnimator.colorAnimation; for (int i = 0; i < this.fRandTime.Length; i++) { this.fRandTime[i] = UnityEngine.Random.value; } }
void StartBirds() { // transform.position = new Vector3( ((Random.Range(0,2)*2)-1) * Random.Range(65f, 80f), transform.position.y, Random.Range(-30f, -20f)); // transform.LookAt(new Vector3(0, transform.position.y, Random.Range(-80f, -50f)) ); Transform birds = (Transform)Instantiate(birdsPrefab, transform.position, transform.rotation); animator = birds.GetComponentInChildren(typeof(ParticleAnimator)) as ParticleAnimator; animator.force = new Vector3(0, Random.Range(-0.3f, 0.3f), 0); emitter = birds.GetComponentInChildren(typeof(ParticleEmitter)) as ParticleEmitter; emitter.emit = true; birdTimer = Time.time + Random.Range(5, 20); }
void getRequiredComponents() { pe = gameObject.GetComponent <ParticleEmitter>(); if (pe == null) { throw new System.Exception("This script can only be used if the gameobject has a ParticleEmitter"); } pa = gameObject.GetComponent <ParticleAnimator>(); if (pa == null) { throw new System.Exception("This script can only be used if the gameobject has a ParticleAnimator"); } }
private void FadeDestroyLegacy(Transform t) { //Debug.Log("FadeAndDestroy called on " + t.name); ParticleEmitter emitter = t.GetComponent <ParticleEmitter>(); ParticleAnimator animator = t.GetComponent <ParticleAnimator>(); if (emitter) { emitter.emit = false; } if (animator) { animator.autodestruct = true; } t.parent = null; }
/*private string[] particleTypes = { * "fx_exhaustFlame_white_tiny", * "fx_exhaustFlame_yellow", * "fx_exhaustFlame_blue", * //"fx_exhaustLight_yellow", * "fx_exhaustLight_blue", * "fx_exhaustFlame_blue_small", * "fx_smokeTrail_light", * "fx_smokeTrail_medium", * "fx_smokeTrail_large", * "fx_smokeTrail_veryLarge", * "fx_smokeTrail_aeroSpike", * "fx_gasBurst_white", * "fx_gasJet_white", * "fx_SRB_large_emit", * "fx_SRB_large_emit2", * "fx_exhaustSparks_flameout", * "fx_exhaustSparks_flameout_2", * "fx_exhaustSparks_yellow", * "fx_shockExhaust_red_small", nope * "fx_shockExhaust_blue_small", * "fx_shockExhaust_blue", * "fx_LES_emit", * "fx_ksX_emit", * "fx_ks25_emit", * "fx_ks1_emit" * };*/ //int currentParticle = 0; private void SetupParticles() { /*UnityEngine.Object o = null; * while (o == null) * { * string name = "Effects/" + particleTypes[currentParticle]; * o = UnityEngine.Resources.Load(name); * currentParticle++; * if (currentParticle >= particleTypes.Length) currentParticle = 0; * }*/ //ScreenMessages.PostScreenMessage(particleTypes[currentParticle]); if (scrapeSparks) { sparkFx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_exhaustSparks_flameout")); sparkFxParticleEmitter = sparkFx.GetComponent <ParticleEmitter>(); sparkFx.transform.parent = part.transform; sparkFx.transform.position = part.transform.position; sparkFxParticleEmitter.localVelocity = Vector3.zero; sparkFxParticleEmitter.useWorldSpace = true; sparkFxParticleEmitter.emit = false; sparkFxParticleEmitter.minEnergy = 0; sparkFxParticleEmitter.minEmission = 0; } dustFx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_smokeTrail_light")); dustFxParticleEmitter = dustFx.GetComponent <ParticleEmitter>(); dustFx.transform.parent = part.transform; dustFx.transform.position = part.transform.position; dustFxParticleEmitter.localVelocity = Vector3.zero; dustFxParticleEmitter.useWorldSpace = true; dustFxParticleEmitter.emit = false; dustFxParticleEmitter.minEnergy = 0; dustFxParticleEmitter.minEmission = 0; dustAnimator = dustFxParticleEmitter.GetComponent <ParticleAnimator>(); /*fragmentFx = (GameObject)GameObject.Instantiate(UnityEngine.Resources.Load("Effects/fx_exhaustSparks_yellow")); * fragmentFx.transform.parent = part.transform; * fragmentFx.transform.position = part.transform.position; * fragmentFx.particleEmitter.localVelocity = Vector3.zero; * fragmentFx.particleEmitter.useWorldSpace = true; * fragmentFx.particleEmitter.emit = false; * fragmentFx.particleEmitter.minEnergy = 0; * fragmentFx.particleEmitter.minEmission = 0; * fragmentAnimator = fragmentFx.particleEmitter.GetComponent<ParticleAnimator>();*/ }
void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Missile") { GameObject newExplosion = (GameObject)Instantiate(Explosion); ParticleEmitter emitter = (ParticleEmitter)newExplosion.GetComponent <ParticleEmitter>(); emitter.emit = true; ParticleAnimator animator = (ParticleAnimator)newExplosion.GetComponent <ParticleAnimator>(); animator.autodestruct = true; AudioSource explosionSound = (AudioSource)newExplosion.GetComponent <AudioSource>(); explosionSound.Play(); newExplosion.transform.position = gameObject.transform.position; Destroy(collider.gameObject); Destroy(gameObject); } }
//----------------- Variables end ----------------------------------// void Awake() { myTransform = transform; // Ignore bullet colliding with Player Physics.IgnoreLayerCollision(8, 9); // Ignore bullet colliding with bullet Physics.IgnoreLayerCollision(8, 8); bulletSpeed = 40; bulletLife = 4; range = 0.5f; alreadyhitsomething = false; isbullet1 = false; isbullet2 = false; particleAnimator = bulletexplosion.GetComponent <ParticleAnimator>(); particleemitter = bulletexplosion.GetComponent <ParticleEmitter>(); particleForce = new Vector3(0, 0, 0); }
private void Awake() { if (this.IsShuriken()) { this.m_ps = base.particleSystem; } else { this.m_pe = base.GetComponent <ParticleEmitter>(); this.m_pa = base.GetComponent <ParticleAnimator>(); this.m_pr = base.GetComponent <ParticleRenderer>(); if (this.m_pe != null) { this.m_bMeshParticleEmitter = this.m_pe.ToString().Contains("MeshParticleEmitter"); } } }
public void Init(string PlanetName, string OtherScaledSpace, float IspeedScale, float IminEmission, float ImaxEmission, float IlifespanMin, float IlifespanMax, float sizeMin, float sizeMax, float sizeGrow, Color[] ColourArray, Vector3 ParticleRandVelocity) { speedScale = IspeedScale; scaledPlanet = Utils.FindScaled(PlanetName); scaledPlanet2 = Utils.FindScaled(OtherScaledSpace); MainEmitter = (ParticleEmitter)scaledPlanet.AddComponent("MeshParticleEmitter"); ParticleRender = scaledPlanet.AddComponent <ParticleRenderer>(); ParticleAnim = scaledPlanet.AddComponent <ParticleAnimator>(); ParticleRender.material = new Material(Shader.Find("Particles/Alpha Blended")); if (Utils.FileExists("GameData/KittopiaSpace/Textures/" + PlanetName + "/Particle.png")) { ParticleRender.material.mainTexture = Utils.LoadTexture("GameData/KittopiaSpace/Textures/" + PlanetName + "/Particle.png"); } else { ParticleRender.material.mainTexture = Utils.LoadTexture("GameData/KittopiaSpace/Textures/Default/Glow.png"); } ParticleAnim.doesAnimateColor = true; ParticleAnim.colorAnimation = ColourArray; minEmission = IminEmission; maxEmission = ImaxEmission; lifespanMin = IlifespanMin; lifespanMax = IlifespanMax; MainEmitter.maxEmission = maxEmission; MainEmitter.maxSize = sizeMax; MainEmitter.maxEnergy = lifespanMax; MainEmitter.minSize = sizeMin; MainEmitter.minEmission = minEmission; MainEmitter.minEnergy = lifespanMin; MainEmitter.useWorldSpace = false; MainEmitter.rndVelocity = ParticleRandVelocity; RndVel = ParticleRandVelocity; //MainEmitter.localVelocity = new Vector3(0f, 0f, 100f); //MainEmitter.emit = true; ParticleAnim.sizeGrow = sizeGrow; }
public void ResetParticleArray() { // We can't place into Awake method. Maybe data has not been initialized. ParticleEmitter[] pfxEmits = gameObject.GetComponentsInChildren <ParticleEmitter>(); particleDataArray = new ParticleData[pfxEmits.Length]; for (int i = 0; i < pfxEmits.Length; i++) { particleDataArray[i] = new ParticleData().Create(pfxEmits[i]); // Turn off the auto destroy caused by the data. ParticleAnimator particleAnimator = (ParticleAnimator)pfxEmits[i].gameObject.GetComponentInChildren(typeof(ParticleAnimator)); if (particleAnimator != null) { particleAnimator.autodestruct = false; } } }
private void KillExplosion() { foreach (ParticleEmitter emitter in base.transform.GetComponentsInChildren <ParticleEmitter>()) { ParticleAnimator component = emitter.transform.GetComponent <ParticleAnimator>(); if (component != null) { component.autodestruct = true; } UnityEngine.Particle[] particles = emitter.particles; for (int i = 0; i < particles.Length; i++) { particles[i].energy = 0.1f; } emitter.particles = particles; } UnityEngine.Object.Destroy(this); }
// Kill all current spawns of the effect. public void killCurrentEffects() { // Loop thru the particle emitter children of this object. // Each one is a particle effect system we want to destroy. ParticleEmitter[] emitters = this.transform.GetComponentsInChildren <ParticleEmitter>(); foreach (ParticleEmitter emitter in emitters) { Debug.Log("resetEffect killing: " + emitter.name); // Make sure autodestruct is on. ParticleAnimator animator = emitter.transform.GetComponent <ParticleAnimator>(); if (animator != null) { animator.autodestruct = true; } // Now loop thru the particles and set their energies to a small number. The effect will // subsequently autodestruct. I originally tried setting the energy to zero, but in that // case they did *not* autodestruct. // I originally tried simply doing a Destroy on the emitter, but got threatening runtime messages. Particle[] p = emitter.particles; for (int i = 0; i < p.Length; i++) { p[i].energy = 0.1f; } emitter.particles = p; emitter.ClearParticles(); } this.gameObject.transform.DetachChildren(); // GameObject Particleclone=GameObject.Find("particle(Clone)"); // GameObject Particleclone=GameObject.Find("particlein1(Clone)"); // Destroy(Particleclone); GameObject[] Particleclone; Particleclone = GameObject.FindGameObjectsWithTag("particlein1"); for (int j = 0; j < Particleclone.Length; j++) { Destroy(Particleclone[j]); } GameObject[] Particlemanager; Particlemanager = GameObject.FindGameObjectsWithTag("ParticleManager"); for (int k = 0; k < Particlemanager.Length; k++) { Destroy(Particlemanager[k]); } }
private void SpawnEffect() { Transform transform = UnityEngine.Object.Instantiate(this.particleEffect, base.transform.position, base.transform.rotation) as Transform; transform.parent = base.gameObject.transform; ParticleEmitter component = transform.GetComponent <ParticleEmitter>(); ParticleAnimator component2 = component.transform.GetComponent <ParticleAnimator>(); if (component2 != null) { component2.autodestruct = true; } component.Emit(this.numberOfArms * this.particlesPerArm); Particle[] particles = component.particles; float num = 6.28318548f / (float)this.numberOfArms; for (int i = 0; i < this.numberOfArms; i++) { float num2 = 0f; float f = (float)i * num; for (int j = 0; j < this.particlesPerArm; j++) { int num3 = i * this.particlesPerArm + j; float num4 = this.originOffset + this.turnDistance * num2; Vector3 position = transform.localPosition; position.x += num4 * Mathf.Cos(num2); position.z += num4 * Mathf.Sin(num2); float x = position.x * Mathf.Cos(f) + position.z * Mathf.Sin(f); float z = -position.x * Mathf.Sin(f) + position.z * Mathf.Cos(f); position.x = x; position.z = z; position.y += (float)j * this.verticalTurnDistance; if (component.useWorldSpace) { position = base.transform.TransformPoint(position); } particles[num3].position = position; num2 += this.particleSeparation; particles[num3].energy = particles[num3].energy - (float)j * this.fadeValue; particles[num3].size = particles[num3].size - (float)j * this.sizeValue; } } component.particles = particles; }
private static int get_sizeGrow(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; float sizeGrow = particleAnimator.get_sizeGrow(); LuaDLL.lua_pushnumber(L, (double)sizeGrow); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index sizeGrow on a nil value"); } return(result); }
private static int set_localRotationAxis(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; Vector3 localRotationAxis = ToLua.ToVector3(L, 2); particleAnimator.localRotationAxis = localRotationAxis; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index localRotationAxis on a nil value"); } return(result); }
private static int set_sizeGrow(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; float sizeGrow = (float)LuaDLL.luaL_checknumber(L, 2); particleAnimator.sizeGrow = sizeGrow; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index sizeGrow on a nil value"); } return(result); }
private static int get_worldRotationAxis(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; Vector3 worldRotationAxis = particleAnimator.worldRotationAxis; ToLua.Push(L, worldRotationAxis); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index worldRotationAxis on a nil value"); } return(result); }
public void Awake() { this._particleEmitter = base.gameObject.AddComponent <EllipsoidParticleEmitter>(); this._particleRenderer = base.gameObject.AddComponent <ParticleRenderer>(); this._particleAnimator = base.gameObject.AddComponent <ParticleAnimator>(); this._particleEmitter.hideFlags = HideFlags.HideAndDontSave; this._particleRenderer.hideFlags = HideFlags.HideAndDontSave; this._particleAnimator.hideFlags = HideFlags.HideAndDontSave; this._particleAnimator.damping = this._baseDamping; this._particleEmitter.emit = false; this._particleRenderer.maxParticleSize = this.maxScreenSize; this._particleRenderer.material = this.material; this._particleRenderer.material.color = Color.white; this._particleAnimator.sizeGrow = this.sizeGrow; if (this.explodeOnAwake) { this.Explode(); } }
private static int get_doesAnimateColor(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; bool doesAnimateColor = particleAnimator.get_doesAnimateColor(); LuaDLL.lua_pushboolean(L, doesAnimateColor); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index doesAnimateColor on a nil value"); } return(result); }
private static int set_colorAnimation(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; Color[] colorAnimation = ToLua.CheckObjectArray <Color>(L, 2); particleAnimator.set_colorAnimation(colorAnimation); result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index colorAnimation on a nil value"); } return(result); }
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 static int set_damping(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; float damping = (float)LuaDLL.luaL_checknumber(L, 2); particleAnimator.set_damping(damping); result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index damping on a nil value"); } return(result); }
private static int get_rndForce(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; Vector3 rndForce = particleAnimator.get_rndForce(); ToLua.Push(L, rndForce); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index rndForce on a nil value"); } return(result); }
// Loop Function -------------------------------------------------------------------- void Awake() { // particleEmitter.emit = false; if (IsShuriken()) { m_ps = GetComponent <ParticleSystem>(); } else { m_pe = GetComponent <ParticleEmitter>(); m_pa = GetComponent <ParticleAnimator>(); m_pr = GetComponent <ParticleRenderer>(); if (m_pe != null) { m_bMeshParticleEmitter = (m_pe.ToString().Contains("MeshParticleEmitter")); } } }
private static int set_force(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); ParticleAnimator particleAnimator = (ParticleAnimator)obj; Vector3 force = ToLua.ToVector3(L, 2); particleAnimator.set_force(force); result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index force on a nil value"); } return(result); }
/// <summary> /// The main initialisation. Here we create the subcomponents. /// </summary> void Awake() { if (!GetComponent<ParticleEmitter>()) { emitter = gameObject.AddComponent<MeshParticleEmitter>(); emitter.useWorldSpace = false; emitter.emit = true; } else { emitter = GetComponent<ParticleEmitter>(); } if (!GetComponent<ParticleAnimator>()) { animator = gameObject.AddComponent<ParticleAnimator>(); animator.doesAnimateColor = true; } else { animator = GetComponent<ParticleAnimator>(); } if (!GetComponent<ParticleRenderer>()) { renderer = gameObject.AddComponent<ParticleRenderer>(); renderer.material = new Material(Shader.Find("Particles/Alpha Blended")); } else { renderer = GetComponent<ParticleRenderer>(); } filter = !GetComponent<MeshFilter>() ? gameObject.AddComponent<MeshFilter>() : GetComponent<MeshFilter>(); }
// Apply event void IParserEventSubscriber.Apply(ConfigNode node) { MainEmitter = (ParticleEmitter)body.AddComponent("MeshParticleEmitter"); ParticleRender = body.AddComponent<ParticleRenderer>(); ParticleAnim = body.AddComponent<ParticleAnimator>(); ParticleRender.material = new Material(Shader.Find("Particles/Alpha Blended")); MainEmitter.useWorldSpace = false; ParticleAnim.doesAnimateColor = true; }