private void LegacyParticleSpeed(float fSpeed) { ParticleEmitter pe = this.m_pe; ParticleAnimator pa = this.m_pa; ParticleRenderer pr = this.m_pr; if (pe == null || pr == null) { return; } Vector3 vector = Vector3.get_one() * fSpeed; ParticleEmitter expr_3B = pe; expr_3B.set_minEnergy(expr_3B.get_minEnergy() / fSpeed); ParticleEmitter expr_49 = pe; expr_49.set_maxEnergy(expr_49.get_maxEnergy() / fSpeed); pe.set_worldVelocity(Vector3.Scale(pe.get_worldVelocity(), vector)); pe.set_localVelocity(Vector3.Scale(pe.get_localVelocity(), vector)); pe.set_rndVelocity(Vector3.Scale(pe.get_rndVelocity(), vector)); ParticleEmitter expr_8D = pe; expr_8D.set_angularVelocity(expr_8D.get_angularVelocity() * fSpeed); ParticleEmitter expr_9B = pe; expr_9B.set_rndAngularVelocity(expr_9B.get_rndAngularVelocity() * fSpeed); ParticleEmitter expr_A9 = pe; expr_A9.set_emitterVelocityScale(expr_A9.get_emitterVelocityScale() * fSpeed); if (pa != null) { pa.set_rndForce(Vector3.Scale(pa.get_rndForce(), vector)); pa.set_force(Vector3.Scale(pa.get_force(), vector)); } }
public void loadLayer() { particleRenderer = new ParticleRenderer(); Rt = new RenderTarget2D(GameLoop.gameInstance.GraphicsDevice, GameSettings.Default.resolutionWidth, GameSettings.Default.resolutionHeight); foreach (LevelObject lo in loList) { lo.LoadContent(); if (lo is ParticleObject) { ParticleObject p = (ParticleObject)lo; particleRenderer.addParticleObjects(p); } } particleRenderer.initializeParticles(); //Effects.Add(e0); if (Effects == null) { Effects = new List <EffectObject>(); } foreach (EffectObject eo in Effects) { //eo.Initialise(); eo.LoadContent(); } }
void OnParticleCollision(GameObject other) { BaseWeapon incomingParticle = other.transform.parent.GetComponent <BaseWeapon>(); SendMessage("TakeDamage", 1.0f - Mathf.Clamp01(incomingParticle.damage / Time.time), SendMessageOptions.DontRequireReceiver); ParticleRenderer curMat = incomingParticle.GetComponentInChildren <ParticleRenderer>(); if (curMat.material == fireMat) { curDamageMat = fireMat; } else if (curMat.material == lightningMat) { curDamageMat = lightningMat; } else { // Wrong material } if (!isTakingExtraDamage) { isTakingExtraDamage = true; } else { isTakingExtraDamage = false; } }
/// <summary> /// Should be used only by ParticleRenderer! /// </summary> public void Init(int indx1, int indx2, ParticleRenderer particle, bool visible) { _particle = particle; this.visible = visible; atomIndex1 = indx1; atomIndex2 = indx2; }
// 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")); }
public void TurnOffParticles() { completed = true; ParticleRenderer particles = GetComponentInChildren <ParticleRenderer>(); particles.enabled = false; }
public void Awake() { gameObject.layer = Globals.LayerNumScenery; _particleEmitter = (gameObject.AddComponent("EllipsoidParticleEmitter")) as ParticleEmitter; _particleRenderer = (gameObject.AddComponent("ParticleRenderer")) as ParticleRenderer; _particleAnimator = (gameObject.AddComponent("ParticleAnimator")) as ParticleAnimator; _particleEmitter.hideFlags = HideFlags.HideAndDontSave; _particleRenderer.hideFlags = HideFlags.HideAndDontSave; _particleAnimator.hideFlags = HideFlags.HideAndDontSave; _particleAnimator.damping = _baseDamping; _particleEmitter.emit = false; _particleRenderer.maxParticleSize = maxScreenSize; _particleRenderer.material = material; _particleRenderer.material.color = Color.white; //workaround for this not being settable elsewhere _particleAnimator.sizeGrow = sizeGrow; if (explodeOnAwake) { Explode(); } }
public void drawInEditor(SpriteBatch spriteBatch) { if (!isVisible) { return; } foreach (LevelObject lo in loList) { if (lo is DrawableLevelObject) { DrawableLevelObject dlo = (DrawableLevelObject)lo; if (dlo.isVisible) { dlo.drawInEditor(spriteBatch); } } } if (particleRenderer == null) { particleRenderer = new ParticleRenderer(_graphicsM); particleRenderer.drawParticlesInEditor(_contentM); } particleRenderer.drawParticlesInEditor(_contentM); }
void LegacyParticleSpeed(float fSpeed) { ParticleEmitter pe = m_pe; ParticleAnimator pa = m_pa; ParticleRenderer pr = m_pr; if (pe == null || pr == null) { return; } Vector3 vecSpeed = Vector3.one * fSpeed; pe.minEnergy /= fSpeed; pe.maxEnergy /= fSpeed; pe.worldVelocity = Vector3.Scale(pe.worldVelocity, vecSpeed); pe.localVelocity = Vector3.Scale(pe.localVelocity, vecSpeed); pe.rndVelocity = Vector3.Scale(pe.rndVelocity, vecSpeed); pe.angularVelocity *= fSpeed; pe.rndAngularVelocity *= fSpeed; pe.emitterVelocityScale *= fSpeed; if (pa != null) { pa.rndForce = Vector3.Scale(pa.rndForce, vecSpeed); pa.force = Vector3.Scale(pa.force, vecSpeed); // pa.damping *= fScale; } // pr.velocityScale *= fSpeed; }
public void Write(SceneWriter writer, object component) { ParticleRenderer pr = component as ParticleRenderer; if (pr == null) { throw new Exception(GetType() + " cannot export components of type " + component.GetType()); } writer.WriteElement("enabled", pr.enabled); writer.WriteElement("sharedMaterials", pr.sharedMaterials); //writer.WriteElement("stretchParticles", pr.); writer.WriteElement("lengthScale", pr.lengthScale); writer.WriteElement("velocityScale", pr.velocityScale); //writer.WriteElement("cameraVelocityScale", pr.cameraVelocityScale); writer.WriteElement("maxParticleSize", pr.maxParticleSize); writer.WriteElement("uvAnimation", new Vector3(pr.uvAnimationXTile, pr.uvAnimationYTile, pr.uvAnimationCycles)); Component c = pr.GetComponent("FFWD_EllipsoidParticleEmitterExport"); if (c == null) { // Added for backwards compatibility c = pr.GetComponent("XNAEllipsoidParticleEmitter"); } if (c != null) { writeValue <object>(writer, c, "stretchParticles"); } }
public void Init(Vessel v, int type) { attachedTo = v; AsteriodType = type; if (AsteriodType == 1) //Comet { try { MainEmitter = (ParticleEmitter)v.rootPart.gameObject.AddComponent("MeshParticleEmitter"); ParticleRender = v.rootPart.gameObject.AddComponent <ParticleRenderer>(); ParticleAnim = v.rootPart.gameObject.AddComponent <ParticleAnimator>(); ParticleRender.material.mainTexture = Utils.LoadTexture("GameData/KittopiaSpace/Textures/Default/Glow.png"); MainEmitter.maxSize = 20; MainEmitter.minSize = 10; MainEmitter.maxEnergy = 5; MainEmitter.minEnergy = 2.5f; MainEmitter.useWorldSpace = false; MainEmitter.rndVelocity = new Vector3(50, 50, 50); MainEmitter.emit = true; } catch {} } CanImpact = false; }
// Use this for initialization void Start() { if (lightning) { particleRenderer = lightning.GetComponent <ParticleRenderer>(); } }
private bool IsReferencedObject(ParticleRenderer component, KeyValuePair <int, TextureDetails> kvp) { bool isExist = true; if (component.material != null) { if (component.material.mainTexture != null && component.material.mainTexture.name.Contains(kvp.Value.objectName)) { return(!isExist); } for (int index = 0; index < _shaderTextures.Length; index++) { string input = _shaderTextures[index]; if (component.material.GetTexture(input) != null && component.material.GetTexture(input).name.Contains(kvp.Value.objectName)) { return(!isExist); } } } return(isExist); }
void OnTriggerEnter(Collider collision) { if (collision.gameObject.tag == "Player" && !completed) { Debug.Log("Player entered"); display = true; completed = true; ParticleRenderer particles = GetComponentInChildren <ParticleRenderer>(); particles.enabled = false; /*Debug.Log("Quest completed! Investigated " + targetName); * completed = true; * Destroy(GetComponent<BoxCollider>()); * * GameObject spawn = Instantiate(area, new Vector3(0.5f, 0.5f, -1), Quaternion.identity) as GameObject; * Area fromSpawn = spawn.GetComponent<Area>(); * fromSpawn.guiTexture.texture = popupTexture; * fromSpawn.destroyAble = true; * fromSpawn.guiTexture.enabled = true; * fromSpawn.PopUpBackground.enabled = true; * fromSpawn.GetComponentInChildren<GUIText>().text = "Uppdrag avklarat " + targetName; * Debug.Log ("X: "+fromSpawn.GetComponentInChildren<GUIText>().pixelOffset.x+"Y: "+fromSpawn.GetComponentInChildren<GUIText>().pixelOffset.y); */SaveCompleted(); } }
public bool ConnectToServer(string ip, int port) { var b = ServerHandler.Connect(ip, port); if (b) { ParticleRenderer = new ParticleRenderer(); SkyboxRenderer = new SkyboxRenderer(); BlockPos playerPos = new BlockPos(0, 100, 0);//MathUtil.NextFloat(-100, 100)); World = new WorldClientServer(); Player = new EntityPlayerSp(World, playerPos.ToVec()); World.AddEntity(Player); Player.SetItemStackInInventory(0, new ItemStack(ItemRegistry.GetItem(BlockRegistry.GetBlock <BlockCraftingTable>()))); ResetMouse(); MouseState state = Mouse.GetState(); _mouseLast = new Point(state.X, state.Y); } return(b); }
/// <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>(); }
private void LegacyParticleSpeed(float fSpeed) { ParticleEmitter pe = this.m_pe; ParticleAnimator pa = this.m_pa; ParticleRenderer pr = this.m_pr; if (pe == null || pr == null) { return; } Vector3 b = Vector3.one * fSpeed; pe.minEnergy /= fSpeed; pe.maxEnergy /= fSpeed; pe.worldVelocity = Vector3.Scale(pe.worldVelocity, b); pe.localVelocity = Vector3.Scale(pe.localVelocity, b); pe.rndVelocity = Vector3.Scale(pe.rndVelocity, b); pe.angularVelocity *= fSpeed; pe.rndAngularVelocity *= fSpeed; pe.emitterVelocityScale *= fSpeed; if (pa != null) { pa.rndForce = Vector3.Scale(pa.rndForce, b); pa.force = Vector3.Scale(pa.force, b); } }
ParticleRenderer partRend;// the new particle renderer void Start() { hero = GameObject.Find("Hero"); partEmit = GetComponent <ParticleEmitter> (); partRend = GetComponent <ParticleRenderer>();//importing the particle renderer HpText = transform.FindChild("DoorHp").GetComponent <TextMesh>() as TextMesh; HpText.color = Color.green; }
/** */ public void CopyAttributesTo(ParticleRenderer renderer) { if (renderer == null) { throw new ArgumentNullException("renderer cannot be null!"); } BeamRenderer_CopyAttributesTo(nativePtr, renderer.nativePtr); }
private void LegacySetParticle() { ParticleEmitter pe = this.m_pe; ParticleAnimator pa = this.m_pa; ParticleRenderer pr = this.m_pr; if (pe == null || pr == null) { return; } if (this.m_bLegacyRuntimeScale) { Vector3 b = Vector3.one * this.m_fStartSpeedRate; float fStartSpeedRate = this.m_fStartSpeedRate; pe.minSize *= this.m_fStartSizeRate; pe.maxSize *= this.m_fStartSizeRate; pe.minEnergy *= this.m_fStartLifeTimeRate; pe.maxEnergy *= this.m_fStartLifeTimeRate; pe.minEmission *= this.m_fStartEmissionRate; pe.maxEmission *= this.m_fStartEmissionRate; pe.worldVelocity = Vector3.Scale(pe.worldVelocity, b); pe.localVelocity = Vector3.Scale(pe.localVelocity, b); pe.rndVelocity = Vector3.Scale(pe.rndVelocity, b); pe.angularVelocity *= fStartSpeedRate; pe.rndAngularVelocity *= fStartSpeedRate; pe.emitterVelocityScale *= fStartSpeedRate; if (pa != null) { pa.rndForce = Vector3.Scale(pa.rndForce, b); pa.force = Vector3.Scale(pa.force, b); } pr.lengthScale *= this.m_fRenderLengthRate; } else { Vector3 b2 = ((!this.m_bScaleWithTransform) ? Vector3.one : pe.transform.lossyScale) * this.m_fStartSpeedRate; float num = ((!this.m_bScaleWithTransform) ? 1f : NcTransformTool.GetTransformScaleMeanValue(pe.transform)) * this.m_fStartSpeedRate; float num2 = ((!this.m_bScaleWithTransform) ? 1f : NcTransformTool.GetTransformScaleMeanValue(pe.transform)) * this.m_fStartSizeRate; pe.minSize *= num2; pe.maxSize *= num2; pe.minEnergy *= this.m_fStartLifeTimeRate; pe.maxEnergy *= this.m_fStartLifeTimeRate; pe.minEmission *= this.m_fStartEmissionRate; pe.maxEmission *= this.m_fStartEmissionRate; pe.worldVelocity = Vector3.Scale(pe.worldVelocity, b2); pe.localVelocity = Vector3.Scale(pe.localVelocity, b2); pe.rndVelocity = Vector3.Scale(pe.rndVelocity, b2); pe.angularVelocity *= num; pe.rndAngularVelocity *= num; pe.emitterVelocityScale *= num; if (pa != null) { pa.rndForce = Vector3.Scale(pa.rndForce, b2); pa.force = Vector3.Scale(pa.force, b2); } pr.lengthScale *= this.m_fRenderLengthRate; } }
/// <summary> /// フレーム毎の描画処理を行います。 /// </summary> protected override void OnRender(EventArgs e) { base.OnRender(e); if (ParticleRenderer != null) { ParticleRenderer.OnRenderFrame(); } }
void Start() { oneOverZigs = 1f / (float)zigs; GetComponent <ParticleEmitter>().emit = false; GetComponent <ParticleEmitter>().Emit(zigs); particles = GetComponent <ParticleEmitter>().particles; rend = GetComponent <ParticleRenderer>(); }
void Awake() { oneOverZigs = 1f / (float)zigs; GetComponent <ParticleEmitter>().emit = false; particleRenderer = GetComponent <ParticleRenderer>(); GetComponent <ParticleEmitter>().Emit(zigs); particles = GetComponent <ParticleEmitter>().particles; particleRenderer.enabled = false; }
public Particle(ParticleController controller, ParticleRenderer renderer) { Controller = controller; Renderer = renderer; Angle = Lens.util.math.Rnd.AnglePI(); Rnd = Lens.util.math.Rnd.Int(1024); T = Lens.util.math.Rnd.Float(1f); }
private void analyzeComponent( Component component, StringBuilder dump, string indent ) { // early out if component is missing if( component == null ) return; List<Material> materials = new List<Material>(); switch( component.GetType().ToString() ) { case "UnityEngine.MeshRenderer": { MeshRenderer mr = component as MeshRenderer; foreach( Material mat in mr.sharedMaterials ) materials.Add( mat ); } break; case "UnityEngine.ParticleRenderer": { ParticleRenderer pr = component as ParticleRenderer; foreach( Material mat in pr.sharedMaterials ) materials.Add( mat ); } break; default: break; } bool materialMissing = false; foreach( Material mat in materials ) { if( mat == null ) { materialMissing = true; dump.Append( indent + "> MISSING\n" ); } else { ListItem item; mSelectionMaterials.TryGetValue( mat, out item ); if( item == null ) { item = new ListItem(); mSelectionMaterials.Add( mat, item ); } item.GameObjects.Add( component.gameObject ); string matName = mat.shader != null ? mat.name + " <" + mat.shader.name + ">" : mat.name + " <MISSING>"; dump.Append( indent + "> " + matName + "\n" ); } } if( materialMissing ) Debug.LogWarning( "Material(s) missing in game object '" + component.gameObject + "'!" ); }
void Start() { completed = false; if (description == "Avklarad!") { completed = true; ParticleRenderer particles = GetComponentInChildren <ParticleRenderer>(); particles.enabled = false; } }
void Start() { ParticleRenderer partRend = GetComponent <ParticleRenderer>(); if (partRend != null) { partRend.sortingLayerName = sortingLayerName; partRend.sortingOrder = sortingLayerInt; } }
private static int _CreateParticleRenderer(IntPtr L) { if (LuaDLL.lua_gettop(L) == 0) { ParticleRenderer obj = new ParticleRenderer(); LuaScriptMgr.Push(L, obj); return(1); } LuaDLL.luaL_error(L, "invalid arguments to method: ParticleRenderer.New"); return(0); }
public AnimatedParticle(ParticleController controller, ParticleRenderer renderer, string animation, string tag = null) : base(controller, renderer) { Animation = Animations.Create(animation); if (tag != null) { Animation.Tag = tag; } Animation.OnEnd += () => { Done = true; }; }
// Use this for initialization void Start() { StartCoroutine("flareLightoff"); flarelight = GetComponent <Light>(); flaresound = GetComponent <AudioSource>(); smokepParSystem = GetComponent <ParticleRenderer>(); Destroy(gameObject, flareTimer + 1f); }
// 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; }
/// <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>(); }