public void Update()
        {
            if (_countPartikel < _maxPartikel)
            {

                float speed = (float)rnd.NextDouble() * 0.3f + 0.2f;
                if (_boothDirections)
                {
                    int negativ = (int)(rnd.NextDouble() * 2);
                    if (negativ == 1)
                        speed *= -1;
                }
                Partikel p = new Partikel(_textureName, (int)(rnd.NextDouble() * 360),
                    _radius + (float)(rnd.NextDouble() * _range),
                    speed);
                    _countPartikel++;
                p._alpha = (float)rnd.NextDouble();
                p.StartColor = _startColor;
                p.EndColor = _endColor;

                _shader.CurrentTechnique.Passes[0].Apply();
                _shader.Parameters["_colorTex"].SetValue(p.DrawColor.ToVector4());

                _partikelList.Add(p);
            }

            foreach (Partikel p in _partikelList)
            {
                Vector2 position;
                position.X = _position.X + (float)Math.Sin((double)MathHelper.ToRadians(p._angle)) * p._radius;
                position.Y = _position.Y + (float)Math.Cos((double)MathHelper.ToRadians(p._angle)) * p._radius;
                p.Update(position);
            }
            
        }
        public void Update()
        {
            if (_countPartikel < _maxPartikel)
            {
                rnd = new Random();
                Vector2 position = new Vector2((float)(rnd.NextDouble()*_rangeX + _drawField.X),(float)( rnd.NextDouble()* _rangeY + _drawField.Z));
                Partikel p = new Partikel(_textureName, position, (float)(rnd.NextDouble()*0.01f));
                _countPartikel++;
                p.StartColor = _startColor;
                p.EndColor = _endColor;
                _partikelList.Add(p);
            }

            foreach (Partikel p in _partikelList)
            {
                if (p._alpha < 0)
                {
                    Vector2 position = new Vector2((float)(rnd.NextDouble() * _rangeX + _drawField.X), (float)(rnd.NextDouble() * _rangeY + _drawField.Z));
                    p._position = position;
                    p._alpha = 0.05f;
                    p._fadeSpeed = -p._fadeSpeed;
                    p.Update();
                }
                else
                    p.Update();
            }
        }
コード例 #3
0
 public void InitAll()
 {
     while (_countPartikel < _maxPartikel)
     {
         Vector2 position = new Vector2((float)(rnd.NextDouble() * _rangeX + _drawField.X), (float)(rnd.NextDouble() * _rangeY + _drawField.Z));
         Partikel p = new Partikel(_textureName, position, 1.0f);
         p._alpha = 1.0f;
         p._fadeSpeed = 1.0f;
         p.StartColor = Color.White;
         p.EndColor = Color.White;
         _countPartikel++;
         _partikelList.Add(p);
     }
 }
コード例 #4
0
        public void Update()
        {
            if (_countPartikel < _maxPartikel)
            {
                Vector2 position = new Vector2((float)(rnd.NextDouble()*_rangeX + _drawField.X),(float)( rnd.NextDouble()* _rangeY + _drawField.Z));
                Partikel p = new Partikel(_textureName, position, (float)(rnd.NextDouble()*0.01f));
                _countPartikel++;
                p.StartColor = _startColor;
                p.EndColor = _endColor;
                _partikelList.Add(p);
            }

            foreach (Partikel p in _partikelList)
            {
                p._position.X += _speed;
            }
        }