deserializeParticleSystem function

ParticleSystem deserializeParticleSystem (
  1. Map data,
  2. {ParticleSystem particleSystem,
  3. SpriteTexture texture}
)

Implementation

ParticleSystem deserializeParticleSystem(Map data, {ParticleSystem particleSystem, SpriteTexture texture}) {
  if (particleSystem == null)
    particleSystem = new ParticleSystem(texture);

  particleSystem.life = data['life'];
  particleSystem.lifeVar = data['lifeVar'];
  particleSystem.posVar = deserializeOffset(data['posVar'].cast<double>());
  particleSystem.startSize = data['startSize'];
  particleSystem.startSizeVar = data['startSizeVar'];
  particleSystem.endSize = data['endSize'];
  particleSystem.endSizeVar = data['endSizeVar'];
  particleSystem.startRotation = data['startRotation'];
  particleSystem.startRotationVar = data['startRotationVar'];
  particleSystem.endRotation = data['endRotation'];
  particleSystem.endRotationVar = data['endRotationVar'];
  particleSystem.rotateToMovement = data['rotateToMovement'];
  particleSystem.direction = data['direction'];
  particleSystem.directionVar = data['directionVar'];
  particleSystem.speed = data['speed'];
  particleSystem.speedVar = data['speedVar'];
  particleSystem.radialAcceleration = data['radialAcceleration'];
  particleSystem.radialAccelerationVar = data['radialAccelerationVar'];
  particleSystem.tangentialAcceleration = data['tangentialAcceleration'];
  particleSystem.tangentialAccelerationVar = data['tangentialAccelerationVar'];
  particleSystem.maxParticles = data['maxParticles'];
  particleSystem.emissionRate = data['emissionRate'];
  particleSystem.colorSequence = deserializeColorSequence(data['colorSequence']);
  particleSystem.alphaVar = data['alphaVar'];
  particleSystem.redVar = data['redVar'];
  particleSystem.greenVar = data['greenVar'];
  particleSystem.blueVar = data['blueVar'];
  particleSystem.numParticlesToEmit = data['numParticlesToEmit'];
  particleSystem.autoRemoveOnFinish = data['autoRemoveOnFinish'];
  particleSystem.gravity = deserializeOffset(data['gravity'].cast<double>());
  if (data['blendMode'] != null)
    particleSystem.transferMode = deserializeBlendMode(data['blendMode']);
  else
    particleSystem.transferMode = BlendMode.plus;

  return particleSystem;
}