Axiom.Core.Root.AddMovableObjectFactory C# (CSharp) Method

AddMovableObjectFactory() public method

Register a new MovableObjectFactory which will create new MovableObject instances of a particular type, as identified by the Type property.
Plugin creators can create subclasses of MovableObjectFactory which construct custom subclasses of MovableObject for insertion in the scene. This is the primary way that plugins can make custom objects available.
public AddMovableObjectFactory ( MovableObjectFactory fact, bool overrideExisting ) : void
fact MovableObjectFactory /// The factory instance. ///
overrideExisting bool /// Set this to true to override any existing /// factories which are registered for the same type. You should only /// change this if you are very sure you know what you're doing. ///
return void
		public void AddMovableObjectFactory( MovableObjectFactory fact, bool overrideExisting )
		{
			if ( this.movableObjectFactoryMap.ContainsKey( fact.Type ) && !overrideExisting )
			{
				throw new AxiomException( "A factory of type '" + fact.Type + "' already exists." );
			}

			if ( fact.RequestTypeFlags )
			{
				if ( this.movableObjectFactoryMap.ContainsValue( fact ) )
				{
					// Copy type flags from the factory we're replacing
					fact.TypeFlag = ( this.movableObjectFactoryMap[ fact.Type ] ).TypeFlag;
				}
				else
				{
					// Allocate new
					fact.TypeFlag = this.NextMovableObjectTypeFlag();
				}
			}

			// Save
			this.movableObjectFactoryMap.Add( fact.Type, fact );

			LogManager.Instance.Write( "Factory " + fact.GetType().Name + " registered for MovableObjectType '" + fact.Type + "'." );
		}