C# Класс 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.

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
Chunk ( ChunkTemplate template ) : System

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

Приватные методы

Метод Описание
Rotate ( ) : bool

Rotates the chunk by 90°.

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

Описание методов

Chunk() защищенный Метод

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.
Результат System

GetAlignedContextCount() публичный Метод

Gets the total number of aligned (used) contexts of this chunk.
public GetAlignedContextCount ( ) : int
Результат int

GetAnchor() публичный Метод

Gets the anchor with the specified chunk-wide unique index.
public GetAnchor ( int index ) : Anchor
index int Index of the anchor to get.
Результат Anchor

GetContext() публичный Метод

Gets the context with the specified chunk-wide unique index.
public GetContext ( int index ) : Context
index int Index of the context to get.
Результат Context

RemoveContext() публичный Метод

Removes passed context from the chunk's list of contexts.
is null.
public RemoveContext ( Context context ) : bool
context Context Context to be removed.
Результат bool