/// <summary> /// Handles the EmitterAdded event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.NewEmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterAdded(Object sender, NewEmitterEventArgs e) { Trace.WriteLine("Adding emitter...", "CORE"); using (new TraceIndenter()) { Trace.WriteLine("Using plugin: " + e.Plugin.Name); } try { AbstractEmitter emitter = e.Plugin.ConstructInstance(); emitter.Initialise(e.Budget, e.Term); emitter.Name = String.Format("Emitter {0}", ++this.NewEmitterIndex); emitter.ParticleTexture = this.DefaultParticleTexture; this.ParticleEffect.Emitters.Add(emitter); e.AddedEmitter = emitter; e.Result = CoreOperationResult.OK; } catch (Exception error) { e.Result = new CoreOperationResult(error); } }
/// <summary> /// Handles the EmitterCloned event of the Interface. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ProjectMercury.EffectEditor.CloneEmitterEventArgs"/> instance containing the event data.</param> public void Interface_EmitterCloned(Object sender, CloneEmitterEventArgs e) { Trace.WriteLine("Cloning emitter...", "CORE"); try { AbstractEmitter clone = e.Prototype.DeepCopy(); clone.Initialise(); clone.ParticleTexture = e.Prototype.ParticleTexture; this.ParticleEffect.Emitters.Add(clone); e.AddedEmitter = clone; e.Result = CoreOperationResult.OK; } catch (Exception error) { e.Result = new CoreOperationResult(error); } }