Show / Hide Table of Contents

Class AdvancedFactory<TBlueprintID, TBlueprintConfig, TProduced>

A more advanced factory that produces a type of object based on a blueprint and a set of configuration parameters.

Inheritance
object
AdvancedFactory<TBlueprintID, TBlueprintConfig, TProduced>
Implements
IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>>
IEnumerable
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.Factories
Assembly: GoRogue.dll
Syntax
[DataContract]
public class AdvancedFactory<TBlueprintID, TBlueprintConfig, TProduced> : IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>>, IEnumerable where TBlueprintID : notnull
Type Parameters
Name Description
TBlueprintID

The type used to uniquely identify blueprints.

TBlueprintConfig

The type of parameter passed to the Create(TBlueprintID, TBlueprintConfig) function each time an object is created.

TProduced

The type of object this factory creates.

Constructors

View Source

AdvancedFactory()

Constructor.

Declaration
public AdvancedFactory()
View Source

AdvancedFactory(IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>>)

Constructor. Takes some initial blueprints to add.

Declaration
public AdvancedFactory(IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>> initialBlueprints)
Parameters
Type Name Description
IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>> initialBlueprints

Initial blueprints to add.

Methods

View Source

Add(IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>)

Adds a blueprint to the factory.

Declaration
public void Add(IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced> blueprint)
Parameters
Type Name Description
IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced> blueprint

The blueprint to add.

View Source

AddRange(IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>>)

Adds the given blueprints to the factory.

Declaration
public void AddRange(IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>> blueprints)
Parameters
Type Name Description
IEnumerable<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>> blueprints

The blueprints to add.

View Source

BlueprintExists(TBlueprintID)

Checks if a blueprint exists.

Declaration
public bool BlueprintExists(TBlueprintID blueprintID)
Parameters
Type Name Description
TBlueprintID blueprintID

The blueprint to check for.

Returns
Type Description
bool

Returns true when the specified blueprintID exists; otherwise false.

View Source

Create(TBlueprintID, TBlueprintConfig)

Creates a TProduced object using the blueprint with the given factory id, and the given settings object.

Declaration
public TProduced Create(TBlueprintID blueprintID, TBlueprintConfig blueprintConfig)
Parameters
Type Name Description
TBlueprintID blueprintID

The factory id of a blueprint.

TBlueprintConfig blueprintConfig

A settings object passed to the Create function of the blueprint.

Returns
Type Description
TProduced

A new object.

View Source

GetBlueprint(TBlueprintID)

Gets a blueprint by identifier.

Declaration
public IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced> GetBlueprint(TBlueprintID blueprintID)
Parameters
Type Name Description
TBlueprintID blueprintID

The blueprint identifier to get.

Returns
Type Description
IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>

The blueprint of the object.

Exceptions
Type Condition
ItemNotDefinedException<TBlueprintID>

Thrown if the factory identifier does not exist.

View Source

GetEnumerator()

Gets an enumerator of all of the blueprints in the factory.

Declaration
public IEnumerator<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>> GetEnumerator()
Returns
Type Description
IEnumerator<IAdvancedFactoryBlueprint<TBlueprintID, TBlueprintConfig, TProduced>>

An enumeration of the blueprints.

Implements

IEnumerable<T>
IEnumerable

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX