Esempio n. 1
0
        public void Generate(GameModel game)
        {
            int lowerBound = 0;
            int upperBound = 0;

            foreach (string textureId in _spritePercentage.Keys)
            {
                int texturePercentage;
                _spritePercentage.TryGetValue(textureId, out texturePercentage);
                lowerBound  = upperBound;
                upperBound += texturePercentage;
                for (int i = 0; i < ParticlesPerGeneration; i++)
                {
                    int angle = _randomMachine.Next(0, (int)_sprayAngle);

                    int result = _randomMachine.Next(1, 100);
                    if (result >= lowerBound && result < upperBound)
                    {
                        float   duration = 10;
                        ISprite sprite   = new Particle(_x, _y, 32, 32, textureId, duration + 1);
                        new MultipleDrawableEffects(new List <IDrawableEffectOverTime>
                        {
                            //new DrawableFlashingEffectOverTime(2,6f),
                            new DrawableRotateFadeMovingEffect(0.1f, duration, 20, new Angle(-Rotation + (angle - _sprayAngle / 2)))
                        }, sprite, 5);
                        game.AddDrawable(sprite);
                    }
                }
            }
        }
Esempio n. 2
0
 public TextSprite(Point screenPosition, string text, GameModel game) : this(screenPosition, text)
 {
     game.AddDrawable(this);
 }