Class GridPlacer
This Unity component manages the grid placing during edit time and runtime.
It will automatically generate a mesh when the world starts, both in editor and in the game. It can also generate the mesh later by calling GenerateNow(Boolean).
Inheritance
System.Object
GridPlacer
Syntax
public class GridPlacer : MonoBehaviour
Fields
backupTiles
Declaration
public DualGridVoxelMeshBackupTiles backupTiles
Field Value
createBottomTiles
Declaration
public bool createBottomTiles
Field Value
Type |
Description |
System.Boolean |
|
createSideTiles
Declaration
public bool createSideTiles
Field Value
Type |
Description |
System.Boolean |
|
createTopTiles
Declaration
public bool createTopTiles
Field Value
Type |
Description |
System.Boolean |
|
generateOnStartUp
Declaration
public GridPlacer.GenerateOnStartUp generateOnStartUp
Field Value
maxCollapseSteps
Declaration
public int maxCollapseSteps
Field Value
Type |
Description |
System.Int32 |
|
maxInGameSecondsPerFrame
Declaration
public float maxInGameSecondsPerFrame
Field Value
Type |
Description |
System.Single |
|
maxPostprocessSteps
Declaration
public int maxPostprocessSteps
Field Value
Type |
Description |
System.Int32 |
|
onFoundCollapsableState
Called when the collapse algorithm has added wildcards and found a collapsable state.
It will now attempt to remove redundant wildcards.
This will only be called if the perfect collapse fails, which would be reported through .
Declaration
public GridPlacer.OnCollapseEvent onFoundCollapsableState
Field Value
onPerfectCollapseFailed
Called when the collapse algorithm finds that it cannot collapse the initial state without adding wildcards.
Declaration
public GridPlacer.OnCollapseEvent onPerfectCollapseFailed
Field Value
onPerfectCollapseSucceeded
Called when the collapse algorithm completes without adding any new wildcards.
Declaration
public GridPlacer.OnCollapseEvent onPerfectCollapseSucceeded
Field Value
onRemovedRedundantWildcards
Called when the collapse algorithm has removed wildcards and found a minimal-wildcard collapsable state.
This will only be called if the perfect collapse fails, which would be reported through .
This will be called after .
Declaration
public GridPlacer.OnCollapseEvent onRemovedRedundantWildcards
Field Value
seed
Declaration
Field Value
Type |
Description |
System.Int32 |
|
showObjectsInHierarchy
Declaration
public bool showObjectsInHierarchy
Field Value
Type |
Description |
System.Boolean |
|
voxelGrid
Declaration
public VoxelGrid voxelGrid
Field Value
Properties
IsGenerating
Declaration
public bool IsGenerating { get; }
Property Value
Type |
Description |
System.Boolean |
|
Tileset
Declaration
public Tileset Tileset { get; }
Property Value
Methods
ClearChildren()
Declaration
public void ClearChildren()
GenerateNow(Boolean)
Generates a new mesh of modules using the associated voxelGrid and tileset assets, and returns once the mesh is fully generated.
Declaration
public void GenerateNow(bool clearExisting = true)
Parameters
Type |
Name |
Description |
System.Boolean |
clearExisting |
If true, clear all of this transform's children before generating the new mesh from the assets.
|
GenerateOverTime(GridPlacer.OnGenerationComplete)
Starts generateing a new mesh of modules using the associated voxelGrid and tileset assets over time.
Declaration
public void GenerateOverTime(GridPlacer.OnGenerationComplete onGenerationComplete = null)
Parameters
Type |
Name |
Description |
GridPlacer.OnGenerationComplete |
onGenerationComplete |
Called when the coroutine finishes creating the transformation of the voxel grid into models
|
InterruptMeshGeneration()
Stop the generation that's currently in progress if there was one. This is silently ignored if there was no generation started, or if the generation has already completed.
Declaration
public void InterruptMeshGeneration()
SetTileset(Tileset)
Declaration
public void SetTileset(Tileset tileset)
Parameters
Type |
Name |
Description |
Tileset |
tileset |
|