Пример #1
0
        public Vector2 Create2()
        {
            // Get the length
            float length = (float)GlobalRandom.Rand(lengthD, avgLength, lengthDev);

            // Get the angle
            float angle = (float)GlobalRandom.Rand(angleD, avgAngle, angleDev);

            // Get the vector
            return(GameMath.Vector2FromRotation(angle, length));
        }
Пример #2
0
        public virtual Vector3 Create()
        {
            // Get the length
            float length = (float)GlobalRandom.Rand(lengthD, avgLength, lengthDev);

            // Get the angle
            float angle  = (float)GlobalRandom.Rand(angleD, avgAngle, angleDev);
            float angle2 = (float)GlobalRandom.Rand(angleD, avgAngle, angleDev);

            // Get the vector
            return(GameMath.Vector3FromRotation(angle, angle2, length));
        }
Пример #3
0
        protected virtual ParticleT createParticle(float elepsedS)
        {
            float percentage = this.calculateEmitterPercentage();

            // Calculate the lifetime
            float lifetime = 1f;

            if (this.AverageLifetimes.Length == 1)
            {
                lifetime = this.AverageLifetimes[0].Value;
            }
            else
            {
                int i = this.AverageLifetimes.GetToIndex(percentage);
                lifetime = GameMath.Lerp(this.AverageLifetimes[i - 1].Value, this.AverageLifetimes[i].Value, AverageLifetimes.GetLerpFactor(i, percentage));
            }
            lifetime = (float)GlobalRandom.Rand(this.Distribution, lifetime, this.LifeTimeDeviation);

            // Adjust the scales
            PercentageArray <float> scales = this.ScalePercentages.Clone();

            if (ScaleDiesToo)
            {
                float factor = lifetime / this.AverageLifetimes[0].Value;
                for (int i = 0; i < scales.Length; i++)
                {
                    scales[i].Value = scales[i].Value * factor;
                }
            }

            // Adjust the alphas
            PercentageArray <float> alphas = this.AlphaPercentages.Clone();

            if (AlphaDiesToo)
            {
                float factor = lifetime / this.AverageLifetimes[0].Value;
                for (int i = 0; i < alphas.Length; i++)
                {
                    alphas[i].Value = alphas[i].Value * factor;
                }
            }

            // Create the particle
            ParticleT particle = this.createParticle(elepsedS, lifetime, scales, alphas);

            return(particle);
        }