예제 #1
0
 public ParticleType()
 {
     _name                          = "New particle type";
     _material                      = IceCream.SceneManager.GlobalDataHolder.GetMaterial("DefaultMaterial");
     _texturePivot                  = new Vector2(0.5f);
     _freeParticles                 = new Queue <Particle>();
     _emissionTimerAccumulator      = 0;
     _useEmitterAngle               = false;
     _keepAspectRatio               = true;
     _attachParticlesToEmitter      = false;
     _blendingType                  = DrawingBlendingType.Alpha;
     _particleOrientationType       = ParticleOrientationType.Fixed;
     _fixedParticleOrientationAngle = 0;
     InitializeValues();
 }
예제 #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;
     }
 }
예제 #3
0
 public ParticleType()
 {
     _name = "New particle type";
     _material = IceCream.SceneManager.GlobalDataHolder.GetMaterial("DefaultMaterial");
     _texturePivot = new Vector2(0.5f);
     _freeParticles = new Queue<Particle>();
     _emissionTimerAccumulator = 0;
     _useEmitterAngle = false;
     _keepAspectRatio = true;
     _attachParticlesToEmitter = false;
     _blendingType = DrawingBlendingType.Alpha;
     _particleOrientationType = ParticleOrientationType.Fixed;
     _fixedParticleOrientationAngle = 0;
     InitializeValues();            
 }
예제 #4
0
파일: Particle.cs 프로젝트: eickegao/tiny2d
 /// <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;
     }
 }