/// <summary> /// Create VGO_PS_EmissionModule from EmissionModule. /// </summary> /// <param name="module"></param> /// <returns></returns> protected virtual VGO_PS_EmissionModule CreateVgoModule(EmissionModule module) { var vgoModule = new VGO_PS_EmissionModule() { enabled = module.enabled, rateOverTime = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.rateOverTime), rateOverTimeMultiplier = module.rateOverTimeMultiplier, rateOverDistance = VgoParticleSystemMinMaxCurveConverter.CreateFrom(module.rateOverDistance), rateOverDistanceMultiplier = module.rateOverDistanceMultiplier, //BurstCount = module.burstCount, }; if (module.burstCount > 0) { Burst[] bursts = new Burst[module.burstCount]; module.GetBursts(bursts); if ((bursts != null) && bursts.Any()) { vgoModule.bursts = new VGO_PS_Burst[bursts.Length]; for (int idx = 0; idx < bursts.Length; idx++) { vgoModule.bursts[idx] = VgoParticleSystemBurstConverter.CreateFrom(bursts[idx]); } } } return(vgoModule); }
/// <summary> /// Set ParticleSystem emission field value. /// </summary> /// <param name="particleSystem"></param> /// <param name="vgoModule"></param> protected virtual void SetModuleValue(ParticleSystem particleSystem, VGO_PS_EmissionModule vgoModule) { if (vgoModule == null) { return; } EmissionModule module = particleSystem.emission; module.enabled = vgoModule.enabled; module.rateOverTime = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.rateOverTime); module.rateOverTimeMultiplier = vgoModule.rateOverTimeMultiplier; module.rateOverDistance = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.rateOverDistance); module.rateOverDistanceMultiplier = vgoModule.rateOverDistanceMultiplier; //module.burstCount = vgoModule.BurstCount; if ((vgoModule.bursts != null) && vgoModule.bursts.Any()) { module.burstCount = vgoModule.bursts.Length; for (int idx = 0; idx < vgoModule.bursts.Length; idx++) { module.SetBurst(idx, VgoParticleSystemBurstConverter.CreateBurst(vgoModule.bursts[idx])); } } }