コード例 #1
0
        public void InitializeValues()
        {
            _useSingleParticle = false;
            overLifeSettings   = new OverLifeSettings();

            _life          = new LinearProperty(45, "Life", 0, 100);
            _quantity      = new LinearProperty(100, "Quantity", 0, 100);
            _width         = new LinearProperty(1, "Width", 0, 10);
            _height        = new LinearProperty(1, "Height", 0, 10);
            _weight        = new LinearProperty(0, "Weight", -10, 10);
            _velocity      = new LinearProperty(4, "Velocity", 0, 10);
            _spin          = new LinearProperty(0, "Spin", -10, 10);
            _motionRandom  = new LinearProperty(0, "Motion Random", 0, 100);
            _opacity       = new LinearProperty(1, "Opacity", 0, 1);
            _emissionAngle = new LinearProperty(0, "Emission Angle", 0, 360);
            _emissionRange = new LinearProperty(360, "Emission Range", 0, 360);
            _redTint       = new LinearProperty(1, "Red Tint", 0, 1);
            _greenTint     = new LinearProperty(1, "Green Tint", 0, 1);
            _blueTint      = new LinearProperty(1, "Blue Tint", 0, 1);

            _lifeVariation         = new LinearProperty(0, "Life Variation", 0, 200);
            _quantityVariation     = new LinearProperty(0, "Quantity Variation", 0, 250);
            _widthVariation        = new LinearProperty(0, "Width Variation", 0, 10);
            _heightVariation       = new LinearProperty(0, "Height Variation", 0, 10);
            _weightVariation       = new LinearProperty(0, "Weight Variation", 0, 10);
            _velocityVariation     = new LinearProperty(0, "Velocity Variation", 0, 10);
            _spinVariation         = new LinearProperty(0, "Spin Variation", 0, 10);
            _motionRandomVariation = new LinearProperty(0, "Motion Random Variation", 0, 10);
            _opacityVariation      = new LinearProperty(0, "Opacity Variation", 0, 4);
            _redTintVariation      = new LinearProperty(0, "Red Tint Variation", 0, 4);
            _greenTintVariation    = new LinearProperty(0, "Green Tint Variation", 0, 4);
            _blueTintVariation     = new LinearProperty(0, "Blue Tint Variation", 0, 4);
        }
コード例 #2
0
 public void CopyValuesTo(OverLifeSettings overLifeSettings)
 {
     this.widthOverLife.CopyValuesTo(overLifeSettings.widthOverLife);
     this.heightOverLife.CopyValuesTo(overLifeSettings.heightOverLife);
     this.velocityOverLife.CopyValuesTo(overLifeSettings.velocityOverLife);
     this.spinOverLife.CopyValuesTo(overLifeSettings.spinOverLife);
     this.motionRandomOverLife.CopyValuesTo(overLifeSettings.motionRandomOverLife);
     this.opacityOverLife.CopyValuesTo(overLifeSettings.opacityOverLife);
     this.redTintOverLife.CopyValuesTo(overLifeSettings.redTintOverLife);
     this.greenTintOverLife.CopyValuesTo(overLifeSettings.greenTintOverLife);
     this.blueTintOverLife.CopyValuesTo(overLifeSettings.blueTintOverLife);
 }
コード例 #3
0
ファイル: Particle.cs プロジェクト: retNull/SquidEngine-XNA
 /// <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;
     }
 }