Beispiel #1
0
 public void CopyValuesTo(Emitter emitter)
 {   
     emitter.currentLife = this.currentLife;
     this.GlobalOpacityModifier.CopyValuesTo(emitter.GlobalOpacityModifier);
     this.EmissionAngle.CopyValuesTo(emitter.EmissionAngle);
     this.EmissionRange.CopyValuesTo(emitter.EmissionRange);            
     emitter.Shape = this.Shape;
     emitter.IsPaused = this.IsPaused;
     emitter.IsStopped = this.IsStopped;
     for (int i = 0; i < this.particleTypes.Count; i++)
     {
         // if no particle type is available
         if (emitter.ParticleTypes.Count <= i)
         {
             emitter.ParticleTypes.Add(new ParticleType());
         }
         this.ParticleTypes[i].CopyValuesTo(emitter.ParticleTypes[i]);
     }
     // Remove remaining types (can cause garbage!)
     for (int i = emitter.ParticleTypes.Count; i > this.particleTypes.Count; i--)
     {
         emitter.ParticleTypes.RemoveAt(i-1);
     }
     emitter.AttractorEnabled = this.AttractorEnabled;
     emitter.AttractorForce = this.AttractorForce;            
     emitter.AttractorPositionOffset = this.AttractorPositionOffset;
 }
 void CreateEmitterSubNodes(TreeNode rootNode, Emitter emitter)
 {
     rootNode.Nodes.Clear();
     rootNode.Nodes.Add("NodeGlobalSettings", "Global settings");
     rootNode.Nodes[0].Nodes.Add("NodeGlobalOpacityModifier", "Global opacity modifier", 1, 2);
     rootNode.Nodes[0].Nodes.Add("NodeEmissionAngle", "Emission angle", 1, 2);
     rootNode.Nodes[0].Nodes.Add("NodeEmissionRange", "Emission range", 1, 2);
     for (int i = 0; i < emitter.ParticleTypes.Count; i++)
     {
         rootNode.Nodes.Add("", emitter.ParticleTypes[i].Name, 3, 3);
         CreateParticleTypeSubNodes(rootNode.Nodes[rootNode.Nodes.Count -1], emitter.ParticleTypes[i]);
     }            
 }
Beispiel #3
0
 public ParticleEffect()
     : base()
 {            
     emitter = new Emitter();
     life = 60;
     _loopMax = 0;
     _editorBackgroundColor = new Color(0, 0, 0, 255);
 }