Exemple #1
0
        /// <summary>
        /// Example of how to create a Particle Initialization Function
        /// </summary>
        /// <param name="cParticle">The Particle to be Initialized</param>
        public void InitializeParticleProperties(DefaultQuadParticle 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 = 2.0f;

            // Set the Particle's initial Position to be wherever the Emitter is
            cParticle.Position = Emitter.PositionData.Position;

            // Set the Particle's Velocity
            Vector3 sVelocityMin = new Vector3(-50, 50, -50);
            Vector3 sVelocityMax = new Vector3(50, 100, 50);

            cParticle.Velocity = DPSFHelper.RandomVectorBetweenTwoVectors(sVelocityMin, sVelocityMax);

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

            // 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.Height = cParticle.StartHeight = cParticle.EndHeight = RandomNumber.Next(10, 50);

            // 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 = cParticle.EndColor = DPSFHelper.RandomColor();
        }
Exemple #2
0
        /// <summary>
        /// Function to Initialize a new Particle's properties
        /// </summary>
        /// <param name="cParticle">The Particle to be Initialized</param>
        public void InitializeParticleProperties(SpriteParticleSystemTemplateParticle cParticle)
        {
            //-----------------------------------------------------------
            // TODO: Initialize all of the Particle's properties here.
            // In addition to initializing the Particle properties you added, you
            // must also initialize the Lifetime property that is inherited from DPSFParticle
            //-----------------------------------------------------------

            // Set the Particle's Lifetime (how long it should exist for)
            cParticle.Lifetime = 2.0f;

            // Set the Particle's initial Position to be wherever the Emitter is
            cParticle.Position = Emitter.PositionData.Position;

            // Set the Particle's Velocity
            Vector3 sVelocityMin = new Vector3(-200, -200, 0);
            Vector3 sVelocityMax = new Vector3(200, -400, 0);

            cParticle.Velocity = DPSFHelper.RandomVectorBetweenTwoVectors(sVelocityMin, sVelocityMax);

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

            // Set the Particle's Width and Height
            cParticle.Width  = RandomNumber.Next((int)mfSizeMin, (int)mfSizeMax);
            cParticle.Height = RandomNumber.Next((int)mfSizeMin, (int)mfSizeMax);
        }
Exemple #3
0
        //===========================================================
        // Other Particle System Functions
        //===========================================================

        //-----------------------------------------------------------
        // TODO: Place any other functions here
        //-----------------------------------------------------------

        private void addIndiParticle(bool frontRing)
        {
            BeatIndicatorParticleSystemParticle cParticle = new BeatIndicatorParticleSystemParticle();

            cParticle.Lifetime = 0;
            //cParticle.ElapsedTime = elapsedAmount;
            Quaternion cBackup = Emitter.OrientationData.Orientation;

            Emitter.OrientationData.Orientation = Quaternion.Identity;
            //InitializeParticleUsingInitialProperties(cParticle);
            Emitter.OrientationData.Orientation = cBackup;

            //cParticle.Position = DPSFHelper.PointOnSphere(MathHelper.PiOver2, RandomNumber.Between(0, MathHelper.TwoPi), startingRadius);
            if (frontRing)
            {
                cParticle.Position = new Vector3(0, 0, 0.5f);
            }
            else
            {
                cParticle.Position = new Vector3(0, 0, -0.5f);
            }
            cParticle.Position += Emitter.PositionData.Position;

            // Set the Particle's initial Position to be wherever the Emitter is
            //cParticle.Position = Emitter.PositionData.Position;

            // Set the Particle's Velocity
            Vector3 sVelocityMin = new Vector3(0, 0, 0);
            Vector3 sVelocityMax = new Vector3(0, 0, 0);

            cParticle.Velocity = DPSFHelper.RandomVectorBetweenTwoVectors(sVelocityMin, sVelocityMax);

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

            // Give the Particle a random Size
            cParticle.Width  = startingRadius;
            cParticle.Height = startingRadius;

            // Give the Particle a random Color
            cParticle.Color = Color;// DPSFHelper.RandomColor();
            AddParticle(cParticle);
        }
Exemple #4
0
        /// <summary>
        /// Function to Initialize a new Particle's properties
        /// </summary>
        /// <param name="cParticle">The Particle to be Initialized</param>
        public void InitializeParticleProperties(BeatIndicatorParticleSystemParticle cParticle)
        {
            //-----------------------------------------------------------
            // TODO: Initialize all of the Particle's properties here.
            // In addition to initializing the Particle properties you added, you
            // must also initialize the Lifetime property that is inherited from DPSFParticle
            //-----------------------------------------------------------
            cParticle.Lifetime = duration;
            //cParticle.ElapsedTime = elapsedAmount;
            Quaternion cBackup = Emitter.OrientationData.Orientation;

            Emitter.OrientationData.Orientation = Quaternion.Identity;
            //InitializeParticleUsingInitialProperties(cParticle);
            Emitter.OrientationData.Orientation = cBackup;

            //cParticle.Position = DPSFHelper.PointOnSphere(MathHelper.PiOver2, RandomNumber.Between(0, MathHelper.TwoPi), startingRadius);
            cParticle.Position = Vector3.Transform(cParticle.Position, Emitter.OrientationData.Orientation);
            //cParticle.Position += Emitter.PositionData.Position;

            // Set the Particle's initial Position to be wherever the Emitter is
            //cParticle.Position = Emitter.PositionData.Position;

            // Set the Particle's Velocity
            Vector3 sVelocityMin = new Vector3(-1, -1, -1);
            Vector3 sVelocityMax = new Vector3(1, 1, 1);

            cParticle.Velocity = DPSFHelper.RandomVectorBetweenTwoVectors(sVelocityMin, sVelocityMax);

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

            // Give the Particle a random Size
            cParticle.Width  = startingRadius;
            cParticle.Height = startingRadius;

            // Give the Particle a random Color
            cParticle.Color = Color;// DPSFHelper.RandomColor();
        }