protected override void ReadFromImpl(object obj)
 {
     base.ReadFromImpl(obj);
     ParticleSystem.NoiseModule uo = (ParticleSystem.NoiseModule)obj;
     enabled               = uo.enabled;
     separateAxes          = uo.separateAxes;
     strength              = uo.strength;
     strengthMultiplier    = uo.strengthMultiplier;
     strengthX             = uo.strengthX;
     strengthXMultiplier   = uo.strengthXMultiplier;
     strengthY             = uo.strengthY;
     strengthYMultiplier   = uo.strengthYMultiplier;
     strengthZ             = uo.strengthZ;
     strengthZMultiplier   = uo.strengthZMultiplier;
     frequency             = uo.frequency;
     damping               = uo.damping;
     octaveCount           = uo.octaveCount;
     octaveMultiplier      = uo.octaveMultiplier;
     octaveScale           = uo.octaveScale;
     quality               = uo.quality;
     scrollSpeed           = uo.scrollSpeed;
     scrollSpeedMultiplier = uo.scrollSpeedMultiplier;
     remapEnabled          = uo.remapEnabled;
     remap            = uo.remap;
     remapMultiplier  = uo.remapMultiplier;
     remapX           = uo.remapX;
     remapXMultiplier = uo.remapXMultiplier;
     remapY           = uo.remapY;
     remapYMultiplier = uo.remapYMultiplier;
     remapZ           = uo.remapZ;
     remapZMultiplier = uo.remapZMultiplier;
     positionAmount   = uo.positionAmount;
     rotationAmount   = uo.rotationAmount;
     sizeAmount       = uo.sizeAmount;
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     s  = this.gameObject.GetComponent <ParticleSystem>();
     nm = s.noise;
     rb = gameObject.GetComponent <Rigidbody>();
     cf = gameObject.GetComponent <ConstantForce>();
 }
Ejemplo n.º 3
0
    void setupNoise(ParticleSystem ps, SystemScrambler ss)
    {
        ParticleSystem.NoiseModule n = ps.noise;

        n.enabled = ss.Enabled [6];
        if (!ss.Enabled [6])
        {
            return;
        }
        n.separateAxes = ss.Bools [4];

        n.frequency = ss.Floats [81];

        if (!n.separateAxes)
        {
            n.strength = ss.Floats [82];
        }
        else
        {
            n.strengthX           = ss.Floats [82];
            n.strengthXMultiplier = ss.Floats [83];
            n.strengthY           = ss.Floats [84];
            n.strengthYMultiplier = ss.Floats [85];
            n.strengthZ           = ss.Floats [86];
            n.strengthZMultiplier = ss.Floats [87];
        }
    }
Ejemplo n.º 4
0
 // Start is called before the first frame update
 void Start()
 {
     particle         = GetComponent <ParticleSystem>();
     pNoise           = particle.noise;
     pMain            = particle.main;
     pMain.startDelay = delay;
 }
Ejemplo n.º 5
0
    // Start is called before the first frame updat
    #if UNITY_EDITOR
    void Start()
    {
        ParticleSystem ps = GetComponent <ParticleSystem>();

        noise           = ps.noise;
        noise.frequency = frequency;
    }
Ejemplo n.º 6
0
        private void MapNoiseParameters(ParticleSystem pSystem, int i)
        {
            ParticleSystem.NoiseModule noiseModule = pSystem.noise;

            try {
                noiseModule.enabled = GetBoolParam(i, "noise_enabled");
            }
            catch (NullReferenceException) {
                noiseModule.enabled = false;
                return;
            }

            noiseModule.quality     = (ParticleSystemNoiseQuality)GetIntParam(i, "noise_quality");
            noiseModule.octaveCount = GetIntParam(i, "noise_octaves");

            noiseModule.separateAxes     = GetBoolParam(i, "noise_separateAxes");
            noiseModule.damping          = GetBoolParam(i, "noise_damping");
            noiseModule.remapEnabled     = GetBoolParam(i, "noise_remap");
            noiseModule.octaveMultiplier = GetFloatParam(i, "noise_octaveMultiplier");
            noiseModule.octaveScale      = GetFloatParam(i, "noise_octaveScale");
            noiseModule.frequency        = GetFloatParam(i, "noise_frequency");
            noiseModule.remap            = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_remapCurve"));
            noiseModule.scrollSpeed      = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_scrollSpeed"));
            noiseModule.positionAmount   = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_positionAmount"));
            noiseModule.rotationAmount   = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_rotationAmount"));
            noiseModule.sizeAmount       = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_scaleAmount"));
            noiseModule.strength         = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_strength"));
            noiseModule.strengthX        = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_strength_x"));
            noiseModule.strengthY        = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_strength_y"));
            noiseModule.strengthZ        = NodeFXUtilities.InterpretStringToCurve(GetStringParam(i, "noise_strength_z"));
        }
Ejemplo n.º 7
0
    protected virtual void GetParticleSystem()
    {
        _particleSystem  = GetComponentInChildren <ParticleSystem>();
        particleRenderer = GetComponentInChildren <ParticleSystemRenderer>();

        // Modules - for ease of access
        mainModule                  = _particleSystem.main;
        collisionModule             = _particleSystem.collision;
        colorBySpeedModule          = _particleSystem.colorBySpeed;
        colorOverTimeModule         = _particleSystem.colorOverLifetime;
        customDataModule            = _particleSystem.customData;
        emissionModule              = _particleSystem.emission;
        externalForcesModule        = _particleSystem.externalForces;
        forceOverTimeModule         = _particleSystem.forceOverLifetime;
        inheritVelocityModule       = _particleSystem.inheritVelocity;
        lightsModule                = _particleSystem.lights;
        limitVelocityOverTimeModule = _particleSystem.limitVelocityOverLifetime;
        noiseModule                 = _particleSystem.noise;
        rotationBySpeedModule       = _particleSystem.rotationBySpeed;
        sizeBySpeedModule           = _particleSystem.sizeBySpeed;
        sizeOverTimeModule          = _particleSystem.sizeOverLifetime;
        trailModule                 = _particleSystem.trails;
        triggerModule               = _particleSystem.trigger;
        shapeModule                 = _particleSystem.shape;
        velOverTimeModule           = _particleSystem.velocityOverLifetime;
    }
 private void FixedUpdate()
 {
     if (!inited)
     {
         Start();
         inited = true;
     }
     if (process)
     {
         float b = 0f;
         if (frame == frameSkip)
         {
             frame = 0;
             b     = ((!Physics.Raycast(base.transform.position + new Vector3(0f, 2f, 0f), Vector3.up, out RaycastHit _, float.PositiveInfinity)) ? maxEmit : minEmit);
         }
         else
         {
             frame++;
         }
         pFX.emissionRate = Mathf.Lerp(pFX.emission.rateOverTime.constantMax, b, speed * Time.deltaTime);
         ParticleSystem.NoiseModule noiseModule = pFX.noise;
         float num2 = noiseModule.strengthMultiplier = Mathf.Lerp(pFX.noise.strengthMultiplier, noise, speed * Time.deltaTime);
         ParticleSystem.ForceOverLifetimeModule forceOverLifetime = pFX.forceOverLifetime;
         Vector3 vector = Vector3.Normalize(windDirection) * windStrength;
         forceOverLifetime.x     = vector.x;
         forceOverLifetime.y     = vector.y;
         forceOverLifetime.z     = vector.z;
         base.transform.rotation = Quaternion.identity;
     }
 }
Ejemplo n.º 9
0
 // Update is called once per frame
 void Awake()
 {
     particleSystem = GetComponent <ParticleSystem>();
     main           = particleSystem.main;
     playerRb       = GetComponentInParent <Rigidbody2D>();
     em             = particleSystem.emission;
     noiseModule    = particleSystem.noise;
 }
Ejemplo n.º 10
0
 void Start()
 {
     main         = particleSystem.main;
     playerRb     = GetComponent <Rigidbody2D>();
     em           = particleSystem.emission;
     em.enabled   = false;
     noiseModule  = particleSystem.noise;
     fom          = particleSystem.forceOverLifetime;
     defaultForce = new Vector2(fom.x.constant, fom.y.constant);
 }
Ejemplo n.º 11
0
    void Start()
    {
        _ps = GetComponent <ParticleSystem>();

        _emission       = _ps.emission;
        _externalForces = _ps.externalForces;
        _noise          = _ps.noise;
        _shape          = _ps.shape;

        _shape.texture         = textures[_textureIndex];
        _emission.rateOverTime = 0;
    }
Ejemplo n.º 12
0
 void Start()
 {
     pSystem        = GetComponent <ParticleSystem>();
     noiseModule    = pSystem.noise;
     mainModule     = pSystem.main;
     startSpeedMax  = mainModule.startSpeed.constantMax;
     limVelModule   = pSystem.limitVelocityOverLifetime;
     velLifeModule  = pSystem.velocityOverLifetime;
     emissionModule = pSystem.emission;
     colLifeModule  = pSystem.colorOverLifetime;
     rotSpeedModule = pSystem.rotationBySpeed;
 }
Ejemplo n.º 13
0
    void UpdateParticlesSpeed(float newSpeed)
    {
        ParticleSystem.MainModule updatableMain = _windParticles.main;
        if (newSpeed == updatableMain.startSpeed.constant)
        {
            return;
        }

        ParticleSystem.NoiseModule updatableNoise = _windParticles.noise;
        updatableNoise.frequency = windSpeed / 25.0f;
        updatableMain.startSpeed = windSpeed;
    }
Ejemplo n.º 14
0
 public bool ToggleNoise()
 {
     ParticleSystem.NoiseModule n = pSystem.noise;
     if (n.enabled)
     {
         n.enabled = false;
     }
     else
     {
         n.enabled = true;
     }
     return(n.enabled);
 }
 public static void ParticleNoiseSettings(this ParticleSystem PS,
                                          bool enabled      = true,
                                          int Octaves       = 0,
                                          float ScrollSpeed = 0.0f,
                                          int Strength      = 0)
 {
     ParticleSystem.NoiseModule noiseModule = PS.noise;
     // Noise settings
     noiseModule.enabled     = enabled;
     noiseModule.octaveCount = Octaves;
     noiseModule.scrollSpeed = ScrollSpeed;
     noiseModule.strength    = Strength;
 }
Ejemplo n.º 16
0
    // Update is called once per frame
    void Update()
    {
        // Various tabs of the particle system module
        ParticleSystem.MainModule  mainParams = beam.main;
        ParticleSystem.NoiseModule noise      = beam.noise;
        ParticleSystem.TrailModule trail      = beam.trails;
        ParticleSystem.VelocityOverLifetimeModule velocity = beam.velocityOverLifetime;

        // Various parts of the main module
        ParticleSystem.MinMaxCurve lifetime = mainParams.startLifetime;
        ParticleSystem.MinMaxCurve speed    = mainParams.startSpeed;

        // Various parts of the trail module
        ParticleSystem.MinMaxGradient color = trail.colorOverLifetime;

        // Switch beams
        if (isHooked && !wasHooked)
        {
            beam.Stop();
            beam.Clear();

            speed.constant         = hookedSpeed;              // Set speed of beam particles
            noise.enabled          = false;                    // Disable noise
            trail.dieWithParticles = false;                    // Give beam a thick look
            velocity.enabled       = true;                     // Do things with the velocity, like spiraling
            color.gradient         = hookedColor;              // Set color of beam
            lifetime.constant      = lengthUnit / hookedSpeed; // Calculate lifetime to give the beam its unit z-scale length
            mainParams.startSpeed  = speed;                    // Put the speed back into the module
            wasHooked = true;                                  // Beam was hooked in this update
            mainParams.startLifetime = lifetime;               // Put the lifetime back into the module
            beam.Play();                                       // Play the beam particle simulation
        }
        else if (!isHooked && wasHooked)
        {
            beam.Stop();
            beam.Clear();

            speed.constant         = freeSpeed;                       // Set speed of beam particles
            noise.enabled          = true;                            // Enable noise
            trail.dieWithParticles = true;                            // Give beam a thin look
            velocity.enabled       = false;                           // Deactivate velocity stuff
            color.gradient         = freeColor;                       // Set color of beam
            lifetime.constant      = (lengthUnit + 1.5f) / freeSpeed; // Calculate lifetime to give the beam its unit z-scale length
            mainParams.startSpeed  = speed;                           // Put the speed back into the module
            wasHooked = false;                                        // Beam was unhooked in this update
            mainParams.startLifetime = lifetime;                      // Put the lifetime back into the module
            beam.Play();                                              // Play the beam particle simulation
        }

        trail.colorOverLifetime = color;    // Put the color back into the module
    }
Ejemplo n.º 17
0
    private Tween UpNoise()
    {
        ParticleSystem.NoiseModule nm = ps.noise;
        var value = 0.0f;

        return(DOTween.To(
                   () => value,
                   num => value = num,
                   2.5f,
                   3.0f
                   ).OnUpdate(() => {
            nm.strength = value;
        }));
    }
Ejemplo n.º 18
0
    void Start()
    {
        var ps = GetComponent <ParticleSystem>();

        _emission         = ps.emission;
        _originalEmission = _emission.rateOverTime.constant;

        _shape          = ps.shape;
        _originalRadius = _shape.radius;

        _noise         = ps.noise;
        _originalNoise = _noise.strength.constant;

        _force = ps.externalForces;
    }
Ejemplo n.º 19
0
    public override void Start()
    {
        base.Start();

        if (ApplicationManager.Instance.UseDebugeMode)
        {
            // enable debug elements
            slider.gameObject.SetActive(true);
            label.enabled = true;
        }

        slider.maxValue = 100;
        slider.minValue = 0;
        slider.value    = slider.minValue;

        dancingNoise = dancingRice.noise;
    }
Ejemplo n.º 20
0
        /// /////////////////////////////////////////////////////////
        /// Noise
        /// /////////////////////////////////////////////////////////

        // Set particle system noise
        public static void SetNoise(ParticleSystem.NoiseModule psNoise, RFParticleNoise scrNoise)
        {
            if (scrNoise.enabled == true)
            {
                psNoise.enabled     = true;
                psNoise.strength    = new ParticleSystem.MinMaxCurve(scrNoise.strengthMin, scrNoise.strengthMax);
                psNoise.frequency   = scrNoise.frequency;
                psNoise.scrollSpeed = scrNoise.scrollSpeed;
                psNoise.damping     = scrNoise.damping;
                psNoise.quality     = scrNoise.quality;


                psNoise.separateAxes = true;
                psNoise.strengthX    = new ParticleSystem.MinMaxCurve(scrNoise.strengthMin, scrNoise.strengthMax);
                psNoise.strengthY    = new ParticleSystem.MinMaxCurve(scrNoise.strengthMin * 0.3f, scrNoise.strengthMax * 0.3f);
                psNoise.strengthZ    = new ParticleSystem.MinMaxCurve(scrNoise.strengthMin, scrNoise.strengthMax);
            }
        }
Ejemplo n.º 21
0
    // Use this for initialization

    void Start()
    {
        //PP = Player;

        _Main01     = Part01.main;
        _Emission01 = Part01.emission;
        _Noise01    = Part01.noise;

        _Main02     = Part02.main;
        _Emission02 = Part02.emission;
        _Noise02    = Part02.noise;

        Particle01 = _Main01.maxParticles;
        Emission01 = _Emission01.rateOverTimeMultiplier;
        Noise01    = _Noise01.strength.constant;
        Particle02 = _Main02.maxParticles;
        Emission02 = _Emission02.rateOverTimeMultiplier;
        Noise02    = _Noise02.strength.constant;
    }
Ejemplo n.º 22
0
        //private static void SetupSmallTracerTrailShape( this ParticleSystem particles )
        //{
        //    var shape = particles.shape;
        //    shape.enabled = true;
        //    shape.
        //}

        private static void SetupSmallTracerTrailNoise(this ParticleSystem particles)
        {
            ParticleSystem.NoiseModule noise = particles.noise;
            noise.enabled          = true;
            noise.separateAxes     = true;
            noise.strengthX        = 1f;
            noise.strengthY        = 1f;
            noise.strengthZ        = 1f;
            noise.frequency        = 2f;
            noise.scrollSpeed      = 1f;
            noise.damping          = false;
            noise.octaveCount      = 1;
            noise.octaveMultiplier = 0.5f;
            noise.octaveScale      = 2f;
            noise.quality          = ParticleSystemNoiseQuality.High;
            noise.remapEnabled     = false;
            noise.positionAmount   = 0.1f;
            noise.rotationAmount   = 0f;
            noise.sizeAmount       = 0f;
        }
        public override void OnEnter()
        {
            _go = Fsm.GetOwnerDefaultTarget(gameObject);
            if (_go == null)
            {
                return;
            }
            _ps = _go.GetComponent <ParticleSystem> ();
            if (_ps == null)
            {
                return;
            }
            _nm = _ps.noise;

            DoExecute();

            if (!everyFrame)
            {
                Finish();
            }
        }
Ejemplo n.º 24
0
    protected virtual void Initialize()
    {
        if (initialized)
        {
            return;
        }

        m_ParticleSystem = GetComponent <ParticleSystem>();

        if (!m_ParticleSystem)
        {
            return;
        }

        main        = m_ParticleSystem.main;
        noise       = m_ParticleSystem.noise;
        emission    = m_ParticleSystem.emission;
        shape       = m_ParticleSystem.shape;
        initialized = true;
        isDirty     = true;
    }
Ejemplo n.º 25
0
 protected override void PerformOperation(Flow flow)
 {
     module = Particle.noise;
     module.separateAxes = SeparateAxes;
     module.damping      = Damping;
     if (!SeparateAxes)
     {
         module.strength = flow.GetValue <float>(Strength);
     }
     else
     {
         module.strengthX = flow.GetValue <float>(StrengthX);
         module.strengthY = flow.GetValue <float>(StrengthY);
         module.strengthZ = flow.GetValue <float>(StrengthZ);
     }
     module.frequency      = flow.GetValue <float>(Frequency);
     module.scrollSpeed    = flow.GetValue <float>(ScrollSpeed);
     module.octaveCount    = flow.GetValue <int>(Octaves);
     module.positionAmount = new ParticleSystem.MinMaxCurve(flow.GetValue <float>(PositionAmount));
     module.rotationAmount = new ParticleSystem.MinMaxCurve(flow.GetValue <float>(RotationAmount));
     module.sizeAmount     = new ParticleSystem.MinMaxCurve(flow.GetValue <float>(SizeAmount));
 }
        private void Update()
        {
            if (CurrentAwarenessData != null)
            {
                ParticleSystem.MainModule targetParticleMain = TargetParticle.main;
                targetParticleMain.simulationSpeed = Mathf.Lerp(targetParticleMain.simulationSpeed, TargetSimulationSpeed, 0.001f);
                targetParticleMain.startColor      = TargetStartColor;
                targetParticleMain.maxParticles    = (int)Mathf.Lerp(targetParticleMain.maxParticles, TargetMaxParticles, 0.002f);

                ParticleSystem.ColorBySpeedModule targetParticleColorBySpeed = TargetParticle.colorBySpeed;
                targetParticleColorBySpeed.color = TargetColorBySpeed;

                ParticleSystem.NoiseModule particleNoise = TargetParticle.noise;
                particleNoise.frequency             = Mathf.Lerp(particleNoise.frequency, TargetParticleNoiseFrequency, 0.9f);
                particleNoise.strength              = Mathf.Lerp(particleNoise.strength.constant, TargetParticleNoiseStrengthConstant, 0.002f);
                particleNoise.scrollSpeedMultiplier = Mathf.Lerp(particleNoise.scrollSpeedMultiplier, TargetNoiseScrollSpeed, 0.001f);

                ParticleSystem.ColorBySpeedModule colorBySpeedModule = TargetParticle.colorBySpeed;
                colorBySpeedModule.range = new Vector2(colorBySpeedModule.range.x,
                                                       Mathf.Lerp(colorBySpeedModule.range.y, TargetColorBySpeedRangeMax, 0.002f));
            }
        }
Ejemplo n.º 27
0
        private void OnEnable()
        {
            if (particles == null)
            {
                particles = gameObject.EnsureComponent <ParticleSystem>();
            }

            mainNoiseModule = particles.noise;

            ParticleSystem.EmissionModule emission = particles.emission;
            emission.rateOverTime     = new ParticleSystem.MinMaxCurve(0);
            emission.rateOverDistance = new ParticleSystem.MinMaxCurve(0);
            emission.enabled          = true;

            ParticleSystem.MainModule main = particles.main;
            main.loop            = false;
            main.playOnAwake     = false;
            main.maxParticles    = Mathf.Min(maxParticles, GlobalMaxParticles);
            main.simulationSpace = ParticleSystemSimulationSpace.World;

            ParticleSystem.ShapeModule shape = particles.shape;
            shape.enabled = false;

            MainParticleRenderer.sharedMaterial = lineMaterial;
            MainParticleRenderer.enabled        = true;

            // Initialize our particles
            for (int i = 0; i < mainParticleArray.Length; i++)
            {
                ParticleSystem.Particle particle = mainParticleArray[i];
                particle.startColor        = Color.white;
                particle.startSize         = 1f;
                particle.startLifetime     = float.MaxValue;
                particle.remainingLifetime = float.MaxValue;
                particle.velocity          = Vector3.zero;
                particle.angularVelocity   = 0;
                mainParticleArray[i]       = particle;
            }
        }
    private void Update()
    {
        if (variables == null)
        {
            return;
        }

        //  ring vertical scale
        for (int i = 0; i < 512; i++)
        {
            float vertical  = Mathf.Clamp(variables.samples[i] * scaleMultiplier + minScale, 0, maxScale);
            float randomNum = Random.Range(-vertical / 10, vertical / 10);

            if (prefabs[i] != null)
            {
                prefabs[i].transform.localScale = new Vector3(1, vertical + randomNum, 1);
            }
        }

        //  ring horizontal cale
        transform.localScale = (Vector3.one * variables.samples[scaleBand - 1] * ringScaleMultiplier) + Vector3.one;

        //  light intensity
        if (thisLight != null)
        {
            thisLight.intensity = variables.bandBuffer[lightIntensityBand - 1] * lightMultiplier;
        }

        //  camera zoom
        thisCamera.fieldOfView = (variables.samples[cameraBand - 1] * -cameraMultiplier) + 60;

        //  particle effects
        if (ps != null)
        {
            ParticleSystem.NoiseModule noiseModule = ps.noise;
            noiseModule.strength = variables.bandBuffer[psBand - 1] * psIntensity + 1;
        }
    }
Ejemplo n.º 29
0
    private void AssignNewSpeed(int segment)
    {
        int val = Random.value < 0.5f ? 1 : -1;

        if (segments[segment] + val == 0)
        {
            val = val * 2;
        }
        if (segments[segment] + val < 0)
        {
            if (AmtOfForwardLanes() <= MinForwardSegments)
            {
                val = 0;
            }
        }
        segments[segment]      = Mathf.Clamp(segments[segment] + val, MinSpeed, MaxSpeed);
        timeTilSwitch[segment] = Random.Range(MinTimePerSwitch, MaxTimePerSwitch);
        ParticleSystem.VelocityOverLifetimeModule vom = effects[segment].velocityOverLifetime;
        vom.x = segments[segment] * 3f;

        ParticleSystem.NoiseModule nm = effects[segment].noise;
        nm.strength = segments[segment] * 0.4f;
    }
Ejemplo n.º 30
0
    private Tween DownNoise()
    {
        ParticleSystem.NoiseModule nm = ps.noise;
        nm.strength = 0;
        ff.gravity  = 0.3f;
        var value = ff.gravity.constant;

        return(DOVirtual.DelayedCall(0.5f, () =>
        {
            ff.gravity = 0.0f;
        }));

        /*
         * return DOTween.To(
         *  () => value,
         *  num => value = num,
         *  0.0f,
         *  1.0f
         * ).OnUpdate(() => {
         *  ff.gravity = value;
         * });
         */
    }