Show / Hide Table of Contents

Class GenerationContext

A context object used for map generation. Map generation steps will require and retrieve components that have been added to this context when they need to retrieve data about the map generated by previous steps.

Inheritance
Object
ComponentCollection
GenerationContext
Implements
IComponentCollection
IEnumerable<ComponentTagPair>
IEnumerable
Inherited Members
ComponentCollection.Add<T>(T, String)
ComponentCollection.Clear()
ComponentCollection.Remove(Object)
ComponentCollection.Remove(Object[])
ComponentCollection.Remove(String)
ComponentCollection.Remove(String[])
ComponentCollection.Contains(Type[])
ComponentCollection.Contains(ComponentTypeTagPair[])
ComponentCollection.Contains(Type, String)
ComponentCollection.Contains<T>(String)
ComponentCollection.GetFirstOrDefault<T>(String)
ComponentCollection.GetFirst<T>(String)
ComponentCollection.GetAll<T>()
ComponentCollection.GetEnumerator()
ComponentCollection.Count
ComponentCollection.ParentForAddedComponents
ComponentCollection.ComponentAdded
ComponentCollection.ComponentRemoved
Namespace: GoRogue.MapGeneration
Assembly: GoRogue.dll
Syntax
public class GenerationContext : ComponentCollection, IComponentCollection, IEnumerable<ComponentTagPair>, IEnumerable

Constructors

GenerationContext(Int32, Int32)

Creates a map context with no components, with the given width/height values.

Declaration
public GenerationContext(int width, int height)
Parameters
Type Name Description
Int32 width

The width of the map this context represents.

Int32 height

The height of the map this context represents.

Fields

Height

Height of the map this context represents.

Declaration
public readonly int Height
Field Value
Type Description
Int32

Width

Width of the map this context represents.

Declaration
public readonly int Width
Field Value
Type Description
Int32

Methods

GetFirstOrNew<TComponent>(Func<TComponent>, String)

Retrieves a context component (optionally with a given tag), or utilizes the specified function to create a new one and adds it if an existing one does not exist.

Declaration
public TComponent GetFirstOrNew<TComponent>(Func<TComponent> newFunc, string tag = null)
    where TComponent : class
Parameters
Type Name Description
Func<TComponent> newFunc

Function to use to create a new component, if there is no existing component.

String tag

An optional tag that must be associated with the retrieved or created component. If null is specified, no tag is associated with a new object, and any object meeting the type requirement will be allowed as the return value.

Returns
Type Description
TComponent

An existing component of the appropriate type if one exists, or the newly created/added component if not.

Type Parameters
Name Description
TComponent

Type of component to retrieve.

Implements

IComponentCollection
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods

Utility.Yield<T>(T)
In This Article
Back to top Generated by DocFX