protected List<Texture2D> textures; /* Textures we can draw on */ #endregion Fields #region Constructors public ParticleEffect(List<Texture2D> textures, ParticleEmitter emitter) { random = new Random(); particles = new List<Particle>(); this.textures = textures; MasterParticles = new List<Particle>(); this.Emitter = emitter; }
public OneShotParticleEffect(List<Texture2D> textures, ParticleEmitter emitter) : base(textures, emitter) { }
private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); string system_name = ""; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string path = dlg.FileName; system_name = ParticleEngine.Instance.LoadFromFile(path); if (system_name != "Fail") { Vector2 temp_location = Vector2.Zero; if (emitter != null) temp_location = emitter.Location; emitter = ParticleEngine.Instance.systems[system_name].effects[0].Emitter; emitter.Location = temp_location; emitter.LastLocation = temp_location; if (ParticleEngine.Instance.systems[system_name].effects[0].TexturePolling == "Random") { rdoRandomPolling.Checked = true; } else rdoRoundRobin.Checked = true; lstParticles.Items.Clear(); foreach (Particle p in ParticleEngine.Instance.systems[system_name].effects[0].MasterParticles) { p.Texture = LoadTexture(p.TextureName); lstParticles.Items.Add(p); } //string what = ParticleEngine.Instance.systems[system_name].effects[0].GetType().ToString().Split('.').Last(); if (ParticleEngine.Instance.systems[system_name].effects[0].GetType().ToString().Split('.').Last() == "ContinuousParticleEffect") { rdoContinuous.Checked = true; } else rdoOneShot.Checked = true; if (ParticleEngine.Instance.systems[system_name].effects[0].BlendingState == "Alpha") rdoAlphaBlending.Checked = true; else rdoAdditiveBlending.Checked = true; CurrentSystemName = system_name; } } }
private void modelViewerControl_MouseClick(object sender, MouseEventArgs e) { if (State == "SetEmitter") { modelViewerControl.EmitterLocation = new Microsoft.Xna.Framework.Vector2(e.X, e.Y); // MessageBox.Show(modelViewerControl.EmitterLocation.ToString()); State = "None"; btnSetEmitter.Enabled = true; btnSetEmitter.Text = "Set Emitter Location"; modelViewerControl.EmitterMarker = LoadTexture("EmitterMarker.bmp"); if (emitter == null) emitter = new ParticleEmitter(); //else //{ emitter.Location = new Microsoft.Xna.Framework.Vector2(e.X, e.Y); emitter.LastLocation = emitter.Location; //} } }
private void btnEmitterProperties_Click(object sender, EventArgs e) { EmitterPropertiesDlg dlg; if (emitter == null) dlg = new EmitterPropertiesDlg(); else dlg = new EmitterPropertiesDlg(emitter); dlg.ShowDialog(); if (dlg.State == "New") { emitter = dlg.BuiltEmitter; emitter.Location = modelViewerControl.EmitterLocation; } else if (dlg.State == "Edit") { emitter = dlg.BuiltEmitter; emitter.Location = modelViewerControl.EmitterLocation; emitter.LastLocation = emitter.Location; } }