CapgeminiSurface.ParticleSystemManager.OnFrame C# (CSharp) Method

OnFrame() private method

private OnFrame ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void OnFrame(object sender, EventArgs e)
        {
            _currentTick = Environment.TickCount;
            _elapsed = (_currentTick - _lastTick)/1000.0;
            _totalElapsed += _elapsed;
            _lastTick = _currentTick;

            _particleSystemManagerEntity.Update((float) _elapsed);

            // #FELO: ON<->OFF Switch
            if (GenerateParticles)
            {
                if (_whiteParticles)
                {
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.Silver,
                                          _minParticleSize + _random.NextDouble(),
                                          _maxParticleLife * _random.NextDouble());
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.Silver,
                                          _minParticleSize + _random.NextDouble(),
                                          _maxParticleLife * _random.NextDouble());
                }
                if (_redParticles)
                {
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.DarkRed,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife * _random.NextDouble());
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.DarkRed,
                                                      _minParticleSize + _random.NextDouble(),
                                                      _maxParticleLife * _random.NextDouble());
                }
                if (_blueParticles)
                {
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.LightBlue,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife * _random.NextDouble());
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.LightBlue,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife * _random.NextDouble());

                }
                if (_greenParticles)
                {
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.LightSeaGreen,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife*_random.NextDouble());
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.LightSeaGreen,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife * _random.NextDouble());
                }
                if (_pinkParticles)
                {
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.Pink,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife * _random.NextDouble());
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.Pink,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife * _random.NextDouble());
                }
                if (_yellowParticles)
                {
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.Yellow,
                                                              _minParticleSize + _random.NextDouble(),
                                                              _maxParticleLife * _random.NextDouble());
                    _particleSystemManagerEntity.SpawnParticle(_spawnPoint, ParticleSpeed, Colors.Yellow,
                                                             _minParticleSize + _random.NextDouble(),
                                                             _maxParticleLife * _random.NextDouble());
                }
                // #FELO: Respawn point.
                _spawnPoint = ParticlePoint3D;
            }
        }