예제 #1
0
 private void ParseParticleSystems(GameObject gameObject, string emitterId, ref List<BabylonExport.Entities.BabylonParticleSystem> particles)
 {
     var particle = gameObject.GetComponent<UnityEditor.BabylonParticleSystem>();
     if (particle != null && particle.exportParticle)
     {
         var particleSystem = new BabylonExport.Entities.BabylonParticleSystem();
         particleSystem.name = (!String.IsNullOrEmpty(particle.particleName)) ? particle.particleName : String.Format("particalSystem#" + Guid.NewGuid().ToString());
         particleSystem.emitterId = emitterId;
         particleSystem.linkToEmitter = true;
         particleSystem.preventAutoStart = !particle.autoStart;
         particleSystem.textureMask = particle.textureMask.ToFloat();
         particleSystem.updateSpeed = particle.updateSpeed;
         particleSystem.emitRate = particle.emitRate;
         particleSystem.gravity = particle.gravity.ToFloat();
         particleSystem.blendMode = (int)particle.blendMode;
         particleSystem.capacity = particle.capacity;
         particleSystem.color1 = particle.color1.ToFloat();
         particleSystem.color2 = particle.color2.ToFloat();
         particleSystem.colorDead = particle.colorDead.ToFloat();
         particleSystem.direction1 = particle.direction1.ToFloat();
         particleSystem.direction2 = particle.direction2.ToFloat();
         particleSystem.minEmitBox = particle.minEmitBox.ToFloat();
         particleSystem.maxEmitBox = particle.maxEmitBox.ToFloat();
         particleSystem.minEmitPower = particle.minEmitPower;
         particleSystem.maxEmitPower = particle.maxEmitPower;
         particleSystem.minLifeTime = particle.minLifeTime;
         particleSystem.maxLifeTime = particle.maxLifeTime;
         particleSystem.minSize = particle.minSize;
         particleSystem.maxSize = particle.maxSize;
         particleSystem.minAngularSpeed = particle.minAngularSpeed;
         particleSystem.maxAngularSpeed = particle.maxAngularSpeed;
         particleSystem.targetStopFrame = particle.targetStopFrame;
         particleSystem.deadAlpha = particle.deadAlpha;
         if (particle.texture != null)
         {
             var babylonTexture = new BabylonTexture();
             var texturePath = AssetDatabase.GetAssetPath(particle.texture);
             CopyTexture(texturePath, particle.texture, babylonTexture);
             particleSystem.textureName = Path.GetFileName(texturePath);
         }
         particles.Add(particleSystem);
     }
 }