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.

Example #1
0
 /// <summary>
 /// Constructs a new context with the same index and relative position
 /// as the passed one and attaches it to the specified chunk.
 /// </summary>
 /// <param name="template">Context whose attributes to copy.</param>
 /// <param name="source">Chunk to attach the new context to.</param>
 internal Context3D(Context3D template, Chunk source)
     : base(template.Tag)
 {
     this.Index = template.Index;
     this.Source = source;
     this.RelativePosition = template.RelativePosition;
 }
Example #2
0
 /// <summary>
 /// Constructs a new anchor with the same index and relative position
 /// as the passed one and attaches it to the specified chunk.
 /// </summary>
 /// <param name="template">Anchor whose attributes to copy.</param>
 /// <param name="source">Chunk to attach the new anchor to.</param>
 internal Anchor2D(Anchor2D template, Chunk source)
     : base(template.Tag)
 {
     this.Index = template.Index;
     this.Source = source;
     this.RelativePosition = template.RelativePosition;
 }
 /// <summary>
 /// Used by <see cref="DiscardOpenChunksPolicy"/> to check whether to discard the passed chunk
 /// with open contexts, or not. Returns <c>true</c>.
 /// </summary>
 /// <param name="chunk">Chunk to be discarded.</param>
 /// <returns><c>true</c></returns>
 public bool ShouldBeDiscarded(Chunk chunk)
 {
     return true;
 }