Abstract class defining the interface to be implemented by creators of ParticleAffector subclasses.
Plugins or 3rd party applications can add new types of particle affectors by creating subclasses of the ParticleAffector class. Because multiple instances of these affectors may be required, a factory class to manage the instances is also required.

ParticleAffectorFactory subclasses must allow the creation and destruction of ParticleAffector subclasses. They must also be registered with the ParticleSystemManager. All factories have a name which identifies them, examples might be 'ForceVector', 'Attractor', or 'Fader', and these can be also be used from particle system scripts.

        /// <summary>
        ///		Internal method for creating a new affector from a factory.
        /// </summary>
        /// <remarks>
        ///		Used internally by the engine to create new ParticleAffector instances from named
        ///		factories. Applications should use the ParticleSystem.AddAffector method instead,
        ///		which calls this method to create an instance.
        /// </remarks>
        /// <param name="emitterType">string name of the affector type to be created. A factory of this type must have been registered.</param>
        internal ParticleAffector CreateAffector(string affectorType)
        {
            ParticleAffectorFactory factory = (ParticleAffectorFactory)affectorFactoryList[affectorType];

            if (factory == null)
            {
                throw new AxiomException("Cannot find requested affector '{0}'.", affectorType);
            }

            return(factory.Create());
        }
        /// <summary>
        ///		Adds a new 'factory' object for affectors to the list of available affector types.
        ///	 </summary>
        ///	  <remarks>
        ///		This method allows plugins etc to add new particle affector types. Particle
        ///		affectors modify the particles in a system a certain way such as affecting their direction
        ///		or changing their color, lifespan etc. Plugins would
        ///		create new subclasses of ParticleAffector which affect particles a certain way, and register
        ///		a subclass of ParticleAffectorFactory to create them.
        ///		<p/>
        ///		All particle affector factories have an assigned name which is used to identify the affector
        ///		type. This must be unique.
        /// </remarks>
        /// <param name="factory"></param>
        public void AddAffectorFactory(ParticleAffectorFactory factory)
        {
            affectorFactoryList.Add(factory.Name, factory);

            log.InfoFormat("Particle Affector type '{0}' registered.", factory.Name);
        }
Exemplo n.º 3
0
        /// <summary>
        ///		Adds a new 'factory' object for affectors to the list of available affector types.
        ///	 </summary>
        ///	  <remarks>
        ///		This method allows plugins etc to add new particle affector types. Particle
        ///		affectors modify the particles in a system a certain way such as affecting their direction
        ///		or changing their color, lifespan etc. Plugins would
        ///		create new subclasses of ParticleAffector which affect particles a certain way, and register
        ///		a subclass of ParticleAffectorFactory to create them.
        ///		<p/>
        ///		All particle affector factories have an assigned name which is used to identify the affector
        ///		type. This must be unique.
        /// </remarks>
        /// <param name="factory"></param>
        public void AddAffectorFactory(ParticleAffectorFactory factory)
        {
            this.affectorFactoryList.Add(factory.Name.ToLower().GetHashCode(), factory);

            LogManager.Instance.Write("Particle Affector type '{0}' registered.", factory.Name);
        }
        /// <summary>
        ///		Adds a new 'factory' object for affectors to the list of available affector types.
        ///	 </summary>
        ///	  <remarks>
        ///		This method allows plugins etc to add new particle affector types. Particle
        ///		affectors modify the particles in a system a certain way such as affecting their direction
        ///		or changing their color, lifespan etc. Plugins would
        ///		create new subclasses of ParticleAffector which affect particles a certain way, and register
        ///		a subclass of ParticleAffectorFactory to create them.
        ///		<p/>
        ///		All particle affector factories have an assigned name which is used to identify the affector
        ///		type. This must be unique.
        /// </remarks>
        /// <param name="factory"></param>
        public void AddAffectorFactory(ParticleAffectorFactory factory)
        {
            affectorFactoryList.Add(factory.Name, factory);

            log.InfoFormat("Particle Affector type '{0}' registered.", factory.Name);
        }
Exemplo n.º 5
0
		/// <summary>
		///		Adds a new 'factory' object for affectors to the list of available affector types.
		///	 </summary>
		///	  <remarks>
		///		This method allows plugins etc to add new particle affector types. Particle
		///		affectors modify the particles in a system a certain way such as affecting their direction
		///		or changing their color, lifespan etc. Plugins would
		///		create new subclasses of ParticleAffector which affect particles a certain way, and register
		///		a subclass of ParticleAffectorFactory to create them.
		///		<p/>
		///		All particle affector factories have an assigned name which is used to identify the affector
		///		type. This must be unique.
		/// </remarks>
		/// <param name="factory"></param>
		public void AddAffectorFactory( ParticleAffectorFactory factory )
		{
			this.affectorFactoryList.Add( factory.Name.ToLower().GetHashCode(), factory );

			LogManager.Instance.Write( "Particle Affector type '{0}' registered.", factory.Name );
		}