Ejemplo n.º 1
0
 /// <summary>
 ///		When this method is called it will create an exact copy of this particle modifier.
 /// </summary>
 /// <returns>Exact copy of this particle modifier.</returns>
 public override ParticleModifier Clone()
 {
     ParticleModifier mod = new ParticleRotationModifier();
     CopyTo(mod);
     return mod;
 }
 /// <summary>
 ///     Called when the add modifier button is clicked.
 /// </summary>
 /// <param name="sender">Object that caused this event to be triggered.</param>
 /// <param name="e">Arguments explaining why this event occured.</param>
 private void addModButton_Click(object sender, EventArgs e)
 {
     if (modifierTypeComboBox.SelectedIndex < 0 || (!(typeListBox.SelectedItem is ParticleTypeItem) && !(typeListBox.SelectedItem is ParticleModifierItem)))
     {
         MessageBox.Show("You must select a modifier type and a particle type.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     ParticleModifier modifier = null;
     switch (modifierTypeComboBox.SelectedItem.ToString().ToLower())
     {
         case "acceleration": modifier = new ParticleAccelerationModifier(); break;
         case "scale": modifier = new ParticleScaleModifier(); break;
         case "rotation": modifier = new ParticleRotationModifier(); break;
         case "color": modifier = new ParticleColorModifier(); break;
         case "render state": modifier = new ParticleRenderStateModifier(); break;
         case "animation": modifier = new ParticleAnimationModifier(); break;
     }
     if (typeListBox.SelectedItem is ParticleTypeItem)
         ((ParticleTypeItem)typeListBox.SelectedItem).Type.RegisterParticleModifier(modifier);
     else
         ((ParticleModifierItem)typeListBox.SelectedItem).Type.RegisterParticleModifier(modifier);
         SyncronizeTypes();
 }