/// <summary> /// Sets a ParticleEffect template. This should only be used through the editor. /// </summary> public void Set(string name, ParticleEffect effect) { _effects.Remove(name); if (effect != null) { effect.Name = name; AddEffect(effect); } }
/// <summary> /// Adds a <see cref="ParticleEffect"/> to this <see cref="ParticleEffectManager"/>. /// </summary> /// <param name="effect">The <see cref="ParticleEffect"/> to add.</param> internal void AddEffect(ParticleEffect effect) { if (effect == null) { Debug.Fail("effect is null."); return; } Debug.Assert(!_effects.ContainsKey(effect.Name)); _effects.Add(effect.Name, effect); }
/// <summary> /// Creates a deep copy of this <see cref="IParticleEffect"/>. /// </summary> /// <returns>A deep copy of this <see cref="IParticleEffect"/>.</returns> public IParticleEffect DeepCopy() { var ret = new ParticleEffect(_effectConfig) { Life = Life, Position = Position }; foreach (var e in _emitters) { e.DeepCopy(ret); } return ret; }
/// <summary> /// Handles the Click event of the <see cref="newPEToolStripMenuItem"/> control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void newPEToolStripMenuItem_Click(object sender, EventArgs e) { const string confirmMsg = "Are you sure you wish to create a new particle effect?"; if (MessageBox.Show(confirmMsg, "Create new particle effect?", MessageBoxButtons.YesNo) == DialogResult.No) return; // Create the new ParticleEffect var pe = new ParticleEffect(); // Save the new ParticleEffect ParticleEffectManager.Instance.Save(ContentPaths.Dev); // Show the editor form var editorFrm = new ParticleEditorForm { ParticleEffect = pe }; editorFrm.Show(dockPanel, DockState.Float); }