Example #1
0
        public void BonusLux(Vector3 mys)
        {
            //LoadParticleSystem();

            // Remove the unnecessary event that was added in the LoadEmitterMagnetParticleSytem() function
            ParticleSystemEvents.RemoveEveryTimeEvent(UpdateEmitterMagnetToTheEmittersPosition, 0, 0);

            // Clear the Magnets List
            if (this.MagnetList != null)
            {
                MagnetList.Clear();

                // Add two Point Magnets

                MagnetList.Add(new MagnetPoint(mys,
                                               DefaultParticleSystemMagnet.MagnetModes.Attract,
                                               DefaultParticleSystemMagnet.DistanceFunctions.SquaredInverse,
                                               0, 100, 20, 0));
            }
        }
Example #2
0
        /// <summary>
        /// Load the Particle System Events and any other settings.
        /// </summary>
        public void LoadParticleSystem()
        {
            // Set the Particle Initialization Function, as it can be changed on the fly
            // and we want to make sure we are using the right one to start with to start with.
            ParticleInitializationFunction = InitializeParticleProperties;

            // Remove all Events first so that none are added twice if this function is called again
            ParticleEvents.RemoveAllEvents();
            ParticleSystemEvents.RemoveAllEvents();

            // Setup the Emitter
            Emitter.ParticlesPerSecond = 100;
            //Emitter.PositionData.Position = new Vector3(-100, 50, 0);

            // Allow the Particle's Velocity, Rotational Velocity, Color, and Transparency to be updated each frame
            ParticleEvents.AddEveryTimeEvent(UpdateParticlePositionUsingVelocity);

            // This function must be executed after the Color Lerp function as the Color Lerp will overwrite the Color's
            // Transparency value, so we give this function an Execution Order of 100 to make sure it is executed last.
            ParticleEvents.AddEveryTimeEvent(UpdateParticleTransparencyToFadeOutUsingLerp, 100);

            // Update the particle to face the camera. Do this after updating it's rotation/orientation.
            ParticleEvents.AddEveryTimeEvent(UpdateParticleToFaceTheCamera, 200);

            ParticleEvents.AddEveryTimeEvent(CheckDistance, 200);
            ParticleSystemEvents.AddTimedEvent(TotalTimeInSeconds, MarkComplete);

            // Call function to add Magnet Particle Event
            ToogleMagnetsAffectPositionOrVelocity();

            // Specify to use the Point Magnet by default
            MagnetList.Clear();

            MagnetList.Add(new MagnetPoint(DestionationPosition,
                                           MagnetsMode, MagnetsDistanceFunction,
                                           _minDistance, _maxDistance, MagnetsForce, 0));
        }