/// <summary>
 ///     Unregisters a particle type with this emitter.
 /// </summary>
 /// <param name="type">Particle type to unregister.</param>
 public void UnregisterParticleType(ParticleType type)
 {
     _particleTypes.Remove(type);
     type.Emitter = null;
 }
 /// <summary>
 ///		When this method is called it will create an exact copy of this parcticle type.
 /// </summary>
 /// <returns>Exact copy of this particle type.</returns>
 public ParticleType Clone()
 {
     ParticleType type = new ParticleType();
     this.CopyTo(type);
     return type;
 }
        /// <summary>
        ///		Copys all the data contained in this particle type to another particle type.
        /// </summary>
        /// <param name="type">Particle type to copy data into.</param>
        public void CopyTo(ParticleType type)
        {
            type._emitter = _emitter;
            type._emitRate = new MinMax(_emitRate.Minimum, _emitRate.Maximum);
            type._cycleEmitRate = _cycleEmitRate;
            type._emitCount = new MinMax(_emitCount.Minimum, _emitCount.Maximum);
            type._particleLifeTimeRandom = new MinMax(_particleLifeTimeRandom.Minimum, _particleLifeTimeRandom.Maximum);
            type._emitShape = _emitShape;
            type._maximumCycles = _maximumCycles;
            type._cycleCount = _cycleCount;

            foreach (ParticleModifier modifier in _modifiers)
            {
                ParticleModifier mod = modifier.Clone();
                mod.ParticleType = type;
                type._modifiers.Add(mod);
            }
        }
 /// <summary>
 ///     Registers a particle type with this emitter.
 /// </summary>
 /// <param name="type">Particle type to register.</param>
 public void RegisterParticleType(ParticleType type)
 {
     _particleTypes.Add(type);
     type.Emitter = this;
 }
        /// <summary>
        ///		Loads this scene node from a given binary reader.
        /// </summary>
        /// <param name="reader">Binary reader to load this scene node from.</param>
        public override void Load(BinaryReader reader)
        {
            // Load all the basic entity details.
            base.Load(reader);

            // Load all the emitter specific details.
            _maximumParticles = reader.ReadInt32();
            int typeCount = reader.ReadInt32();

            // Load each particle type.
            for (int i = 0; i < typeCount; i++)
            {
                ParticleType type = new ParticleType();
                type.Emitter = this;
                type.Load(reader);
                _particleTypes.Add(type);
            }
        }
 /// <summary>
 ///     Invoked when a new instance of this class is created.
 /// </summary>
 /// <param name="type">Particle type this class relates to.</param>
 /// <param name="index">Index of this item.</param>
 public ParticleTypeItem(ParticleType type, int index)
 {
     _index = index;
     _type = type;
 }
 /// <summary>
 ///     Invoked when a new instance of this class is created.
 /// </summary>
 /// <param name="type">Particle type this class is associated with.</param>
 /// <param name="index">Index of this item.</param>
 /// <param name="modifier">Particle modifier this class is associated with.</param>
 public ParticleModifierItem(ParticleType type, ParticleModifier modifier, int index)
 {
     _index = index;
     _type = type;
     _modifier = modifier;
 }
 /// <summary>
 ///     Called when the new type 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 newTypeButton_Click(object sender, EventArgs e)
 {
     ParticleType type = new ParticleType(new MinMax(10, 300), new MinMax(1, 3), EmitShape.Rectangle, 0, new MinMax(500, 2000));
     _emitterNode.RegisterParticleType(type);
     SyncronizeTypes();
 }