Beispiel #1
0
        /// <summary>
        /// Set ParticleSystem forceOverLifetime field value.
        /// </summary>
        /// <param name="particleSystem"></param>
        /// <param name="vgoModule"></param>
        protected virtual void SetModuleValue(ParticleSystem particleSystem, VGO_PS_ForceOverLifetimeModule vgoModule)
        {
            if (vgoModule == null)
            {
                return;
            }

            ForceOverLifetimeModule module = particleSystem.forceOverLifetime;

            module.enabled     = vgoModule.enabled;
            module.x           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.x);
            module.y           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.y);
            module.z           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.z);
            module.xMultiplier = vgoModule.xMultiplier;
            module.yMultiplier = vgoModule.yMultiplier;
            module.zMultiplier = vgoModule.zMultiplier;
            module.space       = vgoModule.space;
            module.randomized  = vgoModule.randomized;
        }
Beispiel #2
0
        /// <summary>
        /// Set ParticleSystem velocityOverLifetime field value.
        /// </summary>
        /// <param name="particleSystem"></param>
        /// <param name="vgoModule"></param>
        protected virtual void SetModuleValue(ParticleSystem particleSystem, VGO_PS_VelocityOverLifetimeModule vgoModule)
        {
            if (vgoModule == null)
            {
                return;
            }

            VelocityOverLifetimeModule module = particleSystem.velocityOverLifetime;

            module.enabled = vgoModule.enabled;

            module.xMultiplier = vgoModule.xMultiplier;
            module.yMultiplier = vgoModule.yMultiplier;
            module.zMultiplier = vgoModule.zMultiplier;
            module.x           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.x);
            module.y           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.y);
            module.z           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.z);

            module.space = vgoModule.space;

            module.orbitalX           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.orbitalX);
            module.orbitalY           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.orbitalY);
            module.orbitalZ           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.orbitalZ);
            module.orbitalXMultiplier = vgoModule.orbitalXMultiplier;
            module.orbitalYMultiplier = vgoModule.orbitalYMultiplier;
            module.orbitalZMultiplier = vgoModule.orbitalZMultiplier;

            module.orbitalOffsetX           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.orbitalOffsetX);
            module.orbitalOffsetY           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.orbitalOffsetY);
            module.orbitalOffsetZ           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.orbitalOffsetZ);
            module.orbitalOffsetXMultiplier = vgoModule.orbitalOffsetXMultiplier;
            module.orbitalOffsetYMultiplier = vgoModule.orbitalOffsetYMultiplier;
            module.orbitalOffsetZMultiplier = vgoModule.orbitalOffsetZMultiplier;

            module.radial           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.radial);
            module.radialMultiplier = vgoModule.radialMultiplier;

            module.speedModifier           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.speedModifier);
            module.speedModifierMultiplier = vgoModule.speedModifierMultiplier;
        }
Beispiel #3
0
        /// <summary>
        /// Set ParticleSystem noiseModule field value.
        /// </summary>
        /// <param name="particleSystem"></param>
        /// <param name="vgoModule"></param>
        protected virtual void SetModuleValue(ParticleSystem particleSystem, VGO_PS_TrailModule vgoModule)
        {
            if (vgoModule == null)
            {
                return;
            }

            TrailModule module = particleSystem.trails;

            module.enabled = vgoModule.enabled;
            module.mode    = vgoModule.mode;

            // PerParticle
            module.ratio              = vgoModule.ratio;
            module.lifetime           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.lifetime);
            module.lifetimeMultiplier = vgoModule.lifetimeMultiplier;
            module.minVertexDistance  = vgoModule.minVertexDistance;
            module.worldSpace         = vgoModule.worldSpace;
            module.dieWithParticles   = vgoModule.dieWithParticles;

            // Ribbon
            module.ribbonCount              = vgoModule.ribbonCount;
            module.splitSubEmitterRibbons   = vgoModule.splitSubEmitterRibbons;
            module.attachRibbonsToTransform = vgoModule.attachRibbonsToTransform;

            module.textureMode              = vgoModule.textureMode;
            module.sizeAffectsWidth         = vgoModule.sizeAffectsWidth;
            module.sizeAffectsLifetime      = vgoModule.sizeAffectsLifetime;
            module.inheritParticleColor     = vgoModule.inheritParticleColor;
            module.colorOverLifetime        = VgoParticleSystemMinMaxGradientConverter.CreateMinMaxGradient(vgoModule.colorOverLifetime);
            module.widthOverTrail           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.widthOverTrail);
            module.widthOverTrailMultiplier = vgoModule.widthOverTrailMultiplier;
            module.colorOverTrail           = VgoParticleSystemMinMaxGradientConverter.CreateMinMaxGradient(vgoModule.colorOverTrail);
            module.generateLightingData     = vgoModule.generateLightingData;
            module.shadowBias = vgoModule.shadowBias;
        }
Beispiel #4
0
        /// <summary>
        /// Set ParticleSystem main field value.
        /// </summary>
        /// <param name="particleSystem"></param>
        /// <param name="vgoModule"></param>
        protected virtual void SetModuleValue(ParticleSystem particleSystem, VGO_PS_MainModule vgoModule)
        {
            if (vgoModule == null)
            {
                return;
            }

            MainModule module = particleSystem.main;

            // @notice
            if (Application.isPlaying == false)
            {
                module.duration = vgoModule.duration;
            }

            module.loop                    = vgoModule.loop;
            module.prewarm                 = vgoModule.prewarm;
            module.startDelay              = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startDelay);
            module.startDelayMultiplier    = vgoModule.startDelayMultiplier;
            module.startLifetime           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startLifetime);
            module.startLifetimeMultiplier = vgoModule.startLifetimeMultiplier;
            module.startSpeed              = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startSpeed);
            module.startSpeedMultiplier    = vgoModule.startSpeedMultiplier;

            module.startSize3D = vgoModule.startSize3D;

            if (vgoModule.startSize3D)
            {
                module.startSizeX           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startSizeX);
                module.startSizeY           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startSizeY);
                module.startSizeZ           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startSizeZ);
                module.startSizeXMultiplier = vgoModule.startSizeXMultiplier;
                module.startSizeYMultiplier = vgoModule.startSizeYMultiplier;
                module.startSizeZMultiplier = vgoModule.startSizeZMultiplier;
            }
            else
            {
                module.startSize           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startSize);
                module.startSizeMultiplier = vgoModule.startSizeMultiplier;
            }

            module.startRotation3D = vgoModule.startRotation3D;

            if (vgoModule.startRotation3D)
            {
                module.startRotationX           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startRotationX);
                module.startRotationY           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startRotationY);
                module.startRotationZ           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startRotationZ);
                module.startRotationXMultiplier = vgoModule.StartRotationXMultiplier;
                module.startRotationYMultiplier = vgoModule.StartRotationYMultiplier;
                module.startRotationZMultiplier = vgoModule.StartRotationZMultiplier;
            }
            else
            {
                module.startRotation           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.startRotation);
                module.startRotationMultiplier = vgoModule.StartRotationMultiplier;
            }

            module.flipRotation              = vgoModule.flipRotation;
            module.startColor                = VgoParticleSystemMinMaxGradientConverter.CreateMinMaxGradient(vgoModule.startColor);
            module.gravityModifier           = VgoParticleSystemMinMaxCurveConverter.CreateMinMaxCurve(vgoModule.gravityModifier);
            module.gravityModifierMultiplier = vgoModule.gravityModifierMultiplier;

            module.simulationSpace = vgoModule.simulationSpace;
            module.simulationSpeed = vgoModule.simulationSpeed;
            VgoTransformConverter.SetComponentValue(module.customSimulationSpace, vgoModule.customSimulationSpace);

            module.useUnscaledTime     = vgoModule.useUnscaledTime;
            module.scalingMode         = vgoModule.scalingMode;
            module.playOnAwake         = vgoModule.playOnAwake;
            module.emitterVelocityMode = vgoModule.emitterVelocityMode;
            module.maxParticles        = vgoModule.maxParticles;
            module.stopAction          = vgoModule.stopAction;
            module.cullingMode         = vgoModule.cullingMode;
            module.ringBufferMode      = vgoModule.ringBufferMode;

            if (vgoModule.ringBufferMode == ParticleSystemRingBufferMode.LoopUntilReplaced)
            {
                module.ringBufferLoopRange = ArrayConverter.ToVector2(vgoModule.ringBufferLoopRange);
            }
        }