C# Class ByChance.Core.Chunk

Main building block that makes up a level.

Chunks are created based on pre-defined chunk templates and define the positions of all contexts and anchors associated with the chunk, as well as attributes that are required for the level generation process such as the probability of a chunk being picked to be added next.

The concrete 2D and 3D implementations of this base class hold additional information regarding their absolute position within the level and their size.

Afficher le fichier Open project: npruehs/bychance Class Usage Examples

Méthodes publiques

Méthode Description
GetAlignedContextCount ( ) : int

Gets the total number of aligned (used) contexts of this chunk.

GetAnchor ( int index ) : Anchor

Gets the anchor with the specified chunk-wide unique index.

GetContext ( int index ) : Context

Gets the context with the specified chunk-wide unique index.

RemoveContext ( Context context ) : bool

Removes passed context from the chunk's list of contexts.

Méthodes protégées

Méthode Description
Chunk ( ChunkTemplate template ) : System

Constructs a new, empty chunk with a reference to the passed chunk template.

Private Methods

Méthode Description
Rotate ( ) : bool

Rotates the chunk by 90°.

Actual rotation algorithm is implemented by the concrete 2D and 3D chunk classes.

Method Details

Chunk() protected méthode

Constructs a new, empty chunk with a reference to the passed chunk template.
is null.
protected Chunk ( ChunkTemplate template ) : System
template ChunkTemplate Chunk template the new chunk will be based on.
Résultat System

GetAlignedContextCount() public méthode

Gets the total number of aligned (used) contexts of this chunk.
public GetAlignedContextCount ( ) : int
Résultat int

GetAnchor() public méthode

Gets the anchor with the specified chunk-wide unique index.
public GetAnchor ( int index ) : Anchor
index int Index of the anchor to get.
Résultat Anchor

GetContext() public méthode

Gets the context with the specified chunk-wide unique index.
public GetContext ( int index ) : Context
index int Index of the context to get.
Résultat Context

RemoveContext() public méthode

Removes passed context from the chunk's list of contexts.
is null.
public RemoveContext ( Context context ) : bool
context Context Context to be removed.
Résultat bool