Class GraphBasedGeneratorGrid2D<TRoom>
Implements a graph-based layout generator that works on the 2D (integer) grid.
Inheritance
System.Object
GraphBasedGeneratorGrid2D<TRoom>
Namespace: Edgar.GraphBasedGenerator.Grid2D
Assembly: Edgar.dll
Syntax
public class GraphBasedGeneratorGrid2D<TRoom> : Object, IRandomInjectable, ICancellable, IObservableGenerator<LayoutGrid2D<TRoom>>, ILayoutGenerator<LayoutGrid2D<TRoom>>
Type Parameters
Name | Description |
---|---|
TRoom |
Constructors
GraphBasedGeneratorGrid2D(LevelDescriptionGrid2D<TRoom>, GraphBasedGeneratorConfiguration<TRoom>)
Creates an instance of the generator.
Declaration
public GraphBasedGeneratorGrid2D(LevelDescriptionGrid2D<TRoom> levelDescription, GraphBasedGeneratorConfiguration<TRoom> configuration = null)
Parameters
Type | Name | Description |
---|---|---|
LevelDescriptionGrid2D<TRoom> | levelDescription | Level description of the level that should be generated. |
GraphBasedGeneratorConfiguration<TRoom> | configuration | Configuration of the generator. Can be omitted for reasonable defaults. |
Properties
IterationsCount
Number of iterations needed to generate the last level.
Declaration
public int IterationsCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TimeTotal
Total time to generate a level.
Declaration
public double TimeTotal { get; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
GenerateLayout()
Generates a layout.
Declaration
public LayoutGrid2D<TRoom> GenerateLayout()
Returns
Type | Description |
---|---|
LayoutGrid2D<TRoom> |
InjectRandomGenerator(Random)
Injects an instance of the Random class. This makes it possible to get always the same results.
Declaration
public void InjectRandomGenerator(Random random)
Parameters
Type | Name | Description |
---|---|---|
System.Random | random | Random numbers generator. |
SetCancellationToken(Nullable<CancellationToken>)
Sets a cancellation token.
Declaration
public void SetCancellationToken(Nullable<CancellationToken> cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Threading.CancellationToken> | cancellationToken | Cancellation token. |
Events
OnPartialValid
Declaration
public event Action<LayoutGrid2D<TRoom>> OnPartialValid
Event Type
Type | Description |
---|---|
System.Action<LayoutGrid2D<TRoom>> |
OnPerturbed
Declaration
public event Action<LayoutGrid2D<TRoom>> OnPerturbed
Event Type
Type | Description |
---|---|
System.Action<LayoutGrid2D<TRoom>> |
OnSimulatedAnnealingEvent
Declaration
public event EventHandler<SimulatedAnnealingEventArgs> OnSimulatedAnnealingEvent
Event Type
Type | Description |
---|---|
System.EventHandler<SimulatedAnnealingEventArgs> |
OnValid
Declaration
public event Action<LayoutGrid2D<TRoom>> OnValid
Event Type
Type | Description |
---|---|
System.Action<LayoutGrid2D<TRoom>> |