Ejemplo n.º 1
0
 public void CopyValuesTo(ParticleType particleType)
 {
     particleType.AttachParticlesToEmitter = this.AttachParticlesToEmitter;
     particleType.BlendingType             = this.BlendingType;
     particleType.Material = this.Material;
     particleType.FixedParticleOrientationAngle = this.FixedParticleOrientationAngle;
     particleType.KeepAspectRatio         = this.KeepAspectRatio;
     particleType.Name                    = this.Name;
     particleType.ParticleOrientationType = this.ParticleOrientationType;
     particleType.UseEmitterAngle         = this.UseEmitterAngle;
     particleType.UseSingleParticle       = this.UseSingleParticle;
     particleType.TileDefault             = this.TileDefault;
     particleType.TileUseRandom           = this.TileUseRandom;
     particleType.TileWidth               = this.TileWidth;
     particleType.TileHeight              = this.TileHeight;
     particleType.TileRows                = this.TileRows;
     particleType.TileCols                = this.TileCols;
     particleType.AnimationFrameDelay     = this.AnimationFrameDelay;
     particleType.AnimationLoop           = this.AnimationLoop;
     particleType.TileTotalOffset         = this.TileTotalOffset;
     this.BlueTint.CopyValuesTo(particleType.BlueTint);
     this.BlueTintVariation.CopyValuesTo(particleType.BlueTintVariation);
     this.EmissionAngle.CopyValuesTo(particleType.EmissionAngle);
     this.EmissionRange.CopyValuesTo(particleType.EmissionRange);
     this.GreenTint.CopyValuesTo(particleType.GreenTint);
     this.GreenTintVariation.CopyValuesTo(particleType.GreenTintVariation);
     this.Height.CopyValuesTo(particleType.Height);
     this.HeightVariation.CopyValuesTo(particleType.HeightVariation);
     this.Life.CopyValuesTo(particleType.Life);
     this.LifeVariation.CopyValuesTo(particleType.LifeVariation);
     this.MotionRandom.CopyValuesTo(particleType.MotionRandom);
     this.MotionRandomVariation.CopyValuesTo(particleType.MotionRandomVariation);
     this.Opacity.CopyValuesTo(particleType.Opacity);
     this.OpacityVariation.CopyValuesTo(particleType.OpacityVariation);
     this.Quantity.CopyValuesTo(particleType.Quantity);
     this.QuantityVariation.CopyValuesTo(particleType.QuantityVariation);
     this.RedTint.CopyValuesTo(particleType.RedTint);
     this.RedTintVariation.CopyValuesTo(particleType.RedTintVariation);
     this.Spin.CopyValuesTo(particleType.Spin);
     this.SpinVariation.CopyValuesTo(particleType.SpinVariation);
     this.Velocity.CopyValuesTo(particleType.Velocity);
     this.VelocityVariation.CopyValuesTo(particleType.VelocityVariation);
     this.Weight.CopyValuesTo(particleType.Weight);
     this.WeightVariation.CopyValuesTo(particleType.WeightVariation);
     this.Width.CopyValuesTo(particleType.Width);
     this.WidthVariation.CopyValuesTo(particleType.WidthVariation);
     this.overLifeSettings.CopyValuesTo(particleType.overLifeSettings);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Modify the properties of a particles (recycling)
 /// </summary>
 public void ModifiyParticle(ParticleType parent, Material material, int tileDefault, bool keepAspectRatio,
                             ParticleOrientationType particleOrientation, float life, float width, float height, float velocity,
                             float weight, float spin, float motionRandom, float direction, Vector2 position, float rotation,
                             float redTint, float greenTint, float blueTint, float opacity, Vector2 pivot, bool isPivotRelative, OverLifeSettings overLifeSettings)
 {
     this._drawRequest.texture      = material.Texture;
     this._drawRequest.IgnoreCamera = parent.Parent.Parent.IgnoreCameraPosition;
     this._keepAspectRatio          = keepAspectRatio;
     this._particleOrientationType  = particleOrientation;
     this._maxLife     = life;
     this._currentLife = 0;
     this._currentTile = tileDefault;
     this._animationTotalTimeElapsed = 0;
     this._animationIsStopped        = false;
     this._initialWidth              = width;
     this._initialHeight             = height;
     this._initialVelocity           = velocity;
     this._initialWeight             = weight;
     this._initialSpin               = spin;
     this._initialMotionRandom       = motionRandom;
     this._initialDirection          = direction;
     _drawRequest.position           = position;
     _drawRequest.rotation           = MathHelper.ToRadians(rotation);
     this._initialColorFloatValues.X = redTint;
     this._initialColorFloatValues.Y = greenTint;
     this._initialColorFloatValues.Z = blueTint;
     this._initialColorFloatValues.W = opacity;
     _drawRequest.pivot              = pivot;
     _drawRequest.isPivotRelative    = isPivotRelative;
     // TO-DO: add pivot support
     this.overLifeSettings = overLifeSettings;
     this._gravity         = Vector2.Zero;
     this._parent          = parent;
     if (parent.Parent.AttractorEnabled)
     {
         Vector2 distanceVector = _parent.Parent.AttractorPosition - position;
         _initialDistanceFromAttractor = distanceVector.Length();
         if (_initialDistanceFromAttractor == 0.0f)
         {
             _initialDistanceFromAttractor = 0.00001f;
         }
     }
     else
     {
         _initialDistanceFromAttractor = null;
     }
 }
Ejemplo n.º 3
0
 void CreateParticleTypeSubNodes(TreeNode rootNode, ParticleType particleType)
 {            
     rootNode.Nodes.Clear();
     rootNode.Nodes.Add("NodeParticleTypeLife", "Life", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeQuantity", "Quantity", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeWidth", "Width", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeHeight", "Height", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeVelocity", "Velocity", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeWeight", "Weight", 1, 2);            
     rootNode.Nodes.Add("NodeParticleTypeSpin", "Spin", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeMotionRandom", "Motion Random", 1, 2);            
     rootNode.Nodes.Add("NodeParticleTypeOpacity", "Opacity", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeEmissionAngle", "EmissionAngle", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeEmissionRange", "EmissionRange", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeRedTint", "Red tint", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeGreenTint", "Green tint", 1, 2);
     rootNode.Nodes.Add("NodeParticleTypeBlueTint", "Blue tint", 1, 2);
     rootNode.Nodes.Add("NodeVariationSettings", "Variation settings", 4, 4);
     int i = rootNode.Nodes.Count - 1;
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationLife", "Life", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationQuantity", "Quantity", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationWidth", "Width", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationHeight", "Height", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationVelocity", "Velocity", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationWeight", "Weight", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationSpin", "Spin", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationMotionRandom", "Motion Random", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationOpacity", "Opacity", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationRedTint", "Red tint", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationGreenTint", "Green tint", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeVariationBlueTint", "Blue tint", 1, 2);            
     rootNode.Nodes.Add("NodeOverLifeSettings", "Over life settings", 6, 6);
     i = rootNode.Nodes.Count - 1;
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeWidth", "Width", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeHeight", "Height", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeVelocity", "Velocity", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeWeight", "Weight", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeSpin", "Spin", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeMotionRandom", "Motion Random", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeOpacity", "Opacity", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeRedTint", "Red tint", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeGreenTint", "Green tint", 1, 2);
     rootNode.Nodes[i].Nodes.Add("NodeParticleTypeOverLifeBlueTint", "Blue tint", 1, 2);
     rootNode.Collapse();
 }        
Ejemplo n.º 4
0
 public void CopyValuesTo(ParticleType particleType)
 {           
     particleType.AttachParticlesToEmitter = this.AttachParticlesToEmitter;
     particleType.BlendingType = this.BlendingType;
     particleType.Material = this.Material;
     particleType.FixedParticleOrientationAngle = this.FixedParticleOrientationAngle;
     particleType.KeepAspectRatio = this.KeepAspectRatio;
     particleType.Name = this.Name;
     particleType.ParticleOrientationType = this.ParticleOrientationType;
     particleType.UseEmitterAngle = this.UseEmitterAngle;
     particleType.UseSingleParticle = this.UseSingleParticle;
     particleType.TileDefault = this.TileDefault;
     particleType.TileUseRandom = this.TileUseRandom;
     particleType.TileWidth = this.TileWidth;
     particleType.TileHeight = this.TileHeight;
     particleType.TileRows = this.TileRows;
     particleType.TileCols = this.TileCols;
     particleType.AnimationFrameDelay = this.AnimationFrameDelay;
     particleType.AnimationLoop = this.AnimationLoop;
     particleType.TileTotalOffset = this.TileTotalOffset;
     this.BlueTint.CopyValuesTo(particleType.BlueTint);
     this.BlueTintVariation.CopyValuesTo(particleType.BlueTintVariation);
     this.EmissionAngle.CopyValuesTo(particleType.EmissionAngle);
     this.EmissionRange.CopyValuesTo(particleType.EmissionRange);
     this.GreenTint.CopyValuesTo(particleType.GreenTint);
     this.GreenTintVariation.CopyValuesTo(particleType.GreenTintVariation);
     this.Height.CopyValuesTo(particleType.Height);
     this.HeightVariation.CopyValuesTo(particleType.HeightVariation);
     this.Life.CopyValuesTo(particleType.Life);
     this.LifeVariation.CopyValuesTo(particleType.LifeVariation);
     this.MotionRandom.CopyValuesTo(particleType.MotionRandom);
     this.MotionRandomVariation.CopyValuesTo(particleType.MotionRandomVariation);
     this.Opacity.CopyValuesTo(particleType.Opacity);
     this.OpacityVariation.CopyValuesTo(particleType.OpacityVariation);
     this.Quantity.CopyValuesTo(particleType.Quantity);
     this.QuantityVariation.CopyValuesTo(particleType.QuantityVariation);
     this.RedTint.CopyValuesTo(particleType.RedTint);
     this.RedTintVariation.CopyValuesTo(particleType.RedTintVariation);
     this.Spin.CopyValuesTo(particleType.Spin);
     this.SpinVariation.CopyValuesTo(particleType.SpinVariation);
     this.Velocity.CopyValuesTo(particleType.Velocity);
     this.VelocityVariation.CopyValuesTo(particleType.VelocityVariation);
     this.Weight.CopyValuesTo(particleType.Weight);
     this.WeightVariation.CopyValuesTo(particleType.WeightVariation);
     this.Width.CopyValuesTo(particleType.Width);
     this.WidthVariation.CopyValuesTo(particleType.WidthVariation);
     this.overLifeSettings.CopyValuesTo(particleType.overLifeSettings);            
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Modify the properties of a particles (recycling)
 /// </summary>
 public void ModifiyParticle(ParticleType parent, Material material, int tileDefault, bool keepAspectRatio, 
     ParticleOrientationType particleOrientation, float life, float width, float height, float velocity,
     float weight, float spin, float motionRandom, float direction, Vector2 position, float rotation,
     float redTint, float greenTint, float blueTint, float opacity, Vector2 pivot, bool isPivotRelative, OverLifeSettings overLifeSettings)
 {
     this._drawRequest.texture = material.Texture;
     this._keepAspectRatio = keepAspectRatio;
     this._particleOrientationType = particleOrientation;
     this._maxLife = life;
     this._currentLife = 0;
     this._currentTile = tileDefault;
     this._animationTotalTimeElapsed = 0;
     this._animationIsStopped = false;
     this._initialWidth = width;
     this._initialHeight = height;
     this._initialVelocity = velocity;
     this._initialWeight = weight;
     this._initialSpin = spin;
     this._initialMotionRandom = motionRandom;
     this._initialDirection = direction;
     _drawRequest.position = position;
     _drawRequest.rotation = MathHelper.ToRadians(rotation);
     this._initialColorFloatValues.X = redTint;
     this._initialColorFloatValues.Y = greenTint;
     this._initialColorFloatValues.Z = blueTint;
     this._initialColorFloatValues.W = opacity;
     _drawRequest.pivot = pivot;
     _drawRequest.isPivotRelative = isPivotRelative;
     // TO-DO: add pivot support
     this.overLifeSettings = overLifeSettings;
     this._gravity = Vector2.Zero;
     this._parent = parent;
     if (parent.Parent.AttractorEnabled)
     {
         Vector2 distanceVector = _parent.Parent.AttractorPosition - position;
         _initialDistanceFromAttractor = distanceVector.Length();
         if (_initialDistanceFromAttractor == 0.0f)
         {
             _initialDistanceFromAttractor = 0.00001f;
         }
     }
     else
     {
         _initialDistanceFromAttractor = null;
     }
 }
Ejemplo n.º 6
0
 public void AddNewParticleType()
 {
     ParticleType newParticleType = new ParticleType();
     newParticleType.Material = SceneManager.GetEmbeddedParticleMaterial();
     particleEffect.Emitter.ParticleTypes.Add(newParticleType);
     particleEffect.Play();
     // add a fade in effect
     particleEffect.Emitter.ParticleTypes[particleEffect.Emitter.ParticleTypes.Count - 1].
         overLifeSettings.opacityOverLife.Values.Add(new Vector2(1, 0));            
 }