Ejemplo n.º 1
0
 private void UpdateSpawnPoints(float deltaTime)
 {
     deltaTime *= this._EmissionFrequencyScale;
     for (int i = 0; i < this._SpawnPoints.Length; i++)
     {
         ComplexWavesEmitter.SpawnPoint spawnPoint = this._SpawnPoints[i];
         spawnPoint.TimeLeft -= deltaTime;
         if (spawnPoint.TimeLeft < 0f)
         {
             float num  = 6.28318548f / spawnPoint.Frequency;
             float num2 = this._Span * 0.3f / num;
             int   min  = Mathf.Max(2, Mathf.RoundToInt(num2 * 0.7f));
             int   max  = Mathf.Max(2, Mathf.RoundToInt(num2 * 1.429f));
             spawnPoint.TimeLeft += spawnPoint.TimeInterval;
             Vector2      position     = spawnPoint.Position + new Vector2(spawnPoint.Direction.y, -spawnPoint.Direction.x) * UnityEngine.Random.Range(-this._Span * 0.35f, this._Span * 0.35f);
             WaveParticle waveParticle = WaveParticle.Create(position, spawnPoint.Direction, spawnPoint.Frequency, spawnPoint.Amplitude, this._Lifetime, this._ShoreWaves);
             if (waveParticle != null)
             {
                 this._WavesParticleSystem.Spawn(waveParticle, UnityEngine.Random.Range(min, max), this._WaveShapeIrregularity, 2f, 0.35f);
                 waveParticle.Destroy();
                 waveParticle.AddToCache();
             }
         }
     }
 }
Ejemplo n.º 2
0
 public void UpdateParticles(float time, float deltaTime)
 {
     if (!base.isActiveAndEnabled)
     {
         return;
     }
     ComplexWavesEmitter.WavesSource wavesSource = this._WavesSource;
     if (wavesSource != ComplexWavesEmitter.WavesSource.CustomWaveFrequency)
     {
         if (wavesSource != ComplexWavesEmitter.WavesSource.WindWavesSpectrum)
         {
             if (wavesSource == ComplexWavesEmitter.WavesSource.Shoaling)
             {
                 if (this._SpawnPoints == null)
                 {
                     this.CreateShoalingSpawnPoints();
                 }
                 this.UpdateSpawnPoints(deltaTime);
             }
         }
         else
         {
             if (this._SpawnPoints == null)
             {
                 this.CreateSpectralWavesSpawnPoints();
             }
             this.UpdateSpawnPoints(deltaTime);
         }
     }
     else if (time > this._NextSpawnTime)
     {
         Vector3      position     = base.transform.position;
         Vector3      forward      = base.transform.forward;
         Vector2      position2    = new Vector2(position.x, position.z);
         Vector2      vector       = new Vector2(forward.x, forward.z);
         WaveParticle waveParticle = WaveParticle.Create(position2, vector.normalized, 6.28318548f / this._Wavelength, this._Amplitude, this._Lifetime, this._ShoreWaves);
         if (waveParticle != null)
         {
             this._WavesParticleSystem.Spawn(waveParticle, this._Width, this._WaveShapeIrregularity, 2f, 0.35f);
             waveParticle.Destroy();
             waveParticle.AddToCache();
         }
         this._NextSpawnTime += this._TimeStep;
     }
 }