Exemple #1
0
        public void InitializeParticlePropertiesRespawn(DefaultSprite3DBillboardParticle cParticle)
        {
            //-----------------------------------------------------------
            // TODO: Initialize all of the Particle's properties here.
            // If you plan on simply using the default InitializeParticleUsingInitialProperties
            // Particle Initialization Function (see the LoadParticleSystem() function above),
            // then you may delete this function all together.
            //-----------------------------------------------------------
            // Set the Particle's Lifetime (how long it should exist for)
            cParticle.Lifetime = 1.0f;

            // Set the Particle's initial Position to be wherever the Emitter is
            cParticle.Position = Vector3.Zero;
            cParticle.Position = Vector3.Transform(cParticle.Position, Emitter.OrientationData.Orientation);


            // Set the Particle's Velocity
            cParticle.Velocity = DPSFHelper.PointOnSphere(RandomNumber.Between(0, MathHelper.TwoPi), RandomNumber.Between(0, MathHelper.TwoPi), radius);

            // Adjust the Particle's Velocity direction according to the Emitter's Orientation
            cParticle.Velocity  = Vector3.Transform(cParticle.Velocity, Emitter.OrientationData.Orientation);
            cParticle.Position += Emitter.PositionData.Position;


            // Give the Particle a random Size
            // Since we have Size Lerp enabled we must also set the Start and End Size
            cParticle.Width      = cParticle.StartWidth = cParticle.EndWidth = cParticle.EndHeight =
                cParticle.Height = cParticle.StartHeight = size;

            // Give the Particle a random Color
            // Since we have Color Lerp enabled we must also set the Start and End Color
            cParticle.Color    = cParticle.StartColor = Color.White;
            cParticle.EndColor = Color.Blue;
        }
Exemple #2
0
        //===========================================================
        // Particle Update Functions
        //===========================================================

        //-----------------------------------------------------------
        // TODO: Place your Particle Update functions here, using the
        // same function prototype as below (i.e. public void FunctionName(DPSFParticle, float))
        //-----------------------------------------------------------

        /// <summary>
        /// Example of how to create a Particle Event Function
        /// </summary>
        /// <param name="cParticle">The Particle to update</param>
        /// <param name="fElapsedTimeInSeconds">How long it has been since the last update</param>
        protected void UpdateParticlePositionBySphereLerp(DefaultSpriteParticle cParticle, float fElapsedTimeInSeconds)
        {
            cParticle.Position = DPSFHelper.PointOnSphere(RandomNumber.Between(0, MathHelper.TwoPi), RandomNumber.Between(0, MathHelper.TwoPi), cParticle.NormalizedElapsedTime * radius);
            cParticle.Position = Vector3.Transform(cParticle.Position, Emitter.OrientationData.Orientation);



            // Adjust the Particle's Velocity direction according to the Emitter's Orientation
            //cParticle.Velocity = Vector3.Transform(cParticle.Velocity, Emitter.OrientationData.Orientation);
            cParticle.Position += Emitter.PositionData.Position;
            // Place code to update the Particle here
            // Example: cParticle.Position += cParticle.Velocity * fElapsedTimeInSeconds;
        }