Esempio n. 1
0
        public Particle(ParticleSystemSettings settings, Vector2 position)
        {
            Position         = position;
            size             = settings.Size.RandomFloat();
            initial_size     = size;
            speed            = settings.Speed.RandomInt();
            lifetime         = settings.Lifetime.RandomFloat();
            initial_lifetime = lifetime;
            acceleration     = new Vector2(settings.AccX.RandomInt(), settings.AccY.RandomInt());
            if (settings.Textures.Count == 0)
            {
                Texture = settings.Texture;
            }
            else
            {
                Texture = settings.Textures[Helper.Rand.Next(settings.Textures.Count)];
            }

            if (settings.Colors.Count == 0)
            {
                Color = settings.Color;
            }
            else
            {
                Color = settings.Colors[Helper.Rand.Next(settings.Colors.Count)];
            }
            Settings = settings;
        }
Esempio n. 2
0
 public ParticleSystem(Vector2 position, ParticleSystemSettings settings)
 {
     Position       = position;
     Settings       = settings;
     Particles      = new List <Particle>();
     lifetime       = Settings.SystemLifetime;
     decimalDensity = settings.Density < 1;
 }