Class PostProcessUtilsGrid2D
Utility post-processing functions used mainly in built-in post-processing logic.
Inheritance
Namespace: Edgar.Unity
Assembly: cs.temp.dll.dll
Syntax
public static class PostProcessUtilsGrid2D
Methods
CenterGrid(DungeonGeneratorLevelGrid2D, Boolean)
Position the grid so that the level is centered at (0,0).
Declaration
public static void CenterGrid(DungeonGeneratorLevelGrid2D level, bool compressBounds = false)
Parameters
Type | Name | Description |
---|---|---|
DungeonGeneratorLevelGrid2D | level | |
System.Boolean | compressBounds | Whether to compress bounds of individual tilemaps before computing the center. |
CopyTiles(RoomInstanceGrid2D, List<Tilemap>, Boolean, Boolean)
Copies tiles from a given room template to given destination tilemaps.
Declaration
public static void CopyTiles(RoomInstanceGrid2D roomInstance, List<Tilemap> destinationTilemaps, bool deleteNonNullTiles, bool deleteTilesInsideOutline)
Parameters
Type | Name | Description |
---|---|---|
RoomInstanceGrid2D | roomInstance | Room instance to be copied to the destination tilemaps. |
System.Collections.Generic.List<Tilemap> | destinationTilemaps | List of destination tilemaps. |
System.Boolean | deleteNonNullTiles | Whether to delete non-null tiles from destination tilemaps. |
System.Boolean | deleteTilesInsideOutline | Whether to delete all tiles insides the outline from destination tilemaps. |
Remarks
One important aspect of this method is how to handle already existing tiles in destination tilemaps.
When deleteNonNullTiles is true, it computes all non-null positions across all layers in the room template. After that, it deletes all tiles on these positions in destination tilemaps.
When deleteTilesInsideOutline is true, it computes all tiles inside the outline of the room template and deletes them from the destination tilemaps. So even if there is a hole inside the room template, the position is still removed.
deleteNonNullTiles and deleteTilesInsideOutline can be combined together.
CopyTilesToSharedTilemaps(DungeonGeneratorLevelGrid2D)
Copies to from individual room templates to shared tilemaps.
Declaration
public static void CopyTilesToSharedTilemaps(DungeonGeneratorLevelGrid2D level)
Parameters
Type | Name | Description |
---|---|---|
DungeonGeneratorLevelGrid2D | level |
Remarks
The order is important. First, copy all basic rooms and only then copy corridor rooms.
Destroy(Object)
Declaration
public static void Destroy(Object gameObject)
Parameters
Type | Name | Description |
---|---|---|
Object | gameObject |
DisableRoomTemplateColliders(DungeonGeneratorLevelGrid2D)
Disables colliders of individual room template tilemaps in the generated level. The goal is to try to keep triggers functioning.
Declaration
public static void DisableRoomTemplateColliders(DungeonGeneratorLevelGrid2D level)
Parameters
Type | Name | Description |
---|---|---|
DungeonGeneratorLevelGrid2D | level |
DisableRoomTemplateColliders(GameObject)
Disables colliders of individual tilemaps in a given room template. The goal is to try to keep triggers functioning.
Declaration
public static void DisableRoomTemplateColliders(GameObject roomTemplate)
Parameters
Type | Name | Description |
---|---|---|
GameObject | roomTemplate |
DisableRoomTemplateRenderers(DungeonGeneratorLevelGrid2D)
Disables tilemap renderers in room template instances.
Declaration
public static void DisableRoomTemplateRenderers(DungeonGeneratorLevelGrid2D level)
Parameters
Type | Name | Description |
---|---|---|
DungeonGeneratorLevelGrid2D | level |
Remarks
This method is useful when using shared tilemaps.
DisableRoomTemplateRenderers(GameObject)
Disables tilemap renderers in a given room template.
Declaration
public static void DisableRoomTemplateRenderers(GameObject roomTemplate)
Parameters
Type | Name | Description |
---|---|---|
GameObject | roomTemplate |
GetTilemapsCenter(List<Tilemap>, Boolean)
Gets the center point of given tilemaps-
Declaration
public static Vector3 GetTilemapsCenter(List<Tilemap> tilemaps, bool compressBounds = false)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<Tilemap> | tilemaps | |
System.Boolean | compressBounds | Whether to compress bounds of individual tilemaps before computing the center. |
Returns
Type | Description |
---|---|
Vector3 |
InitializeSharedTilemaps(DungeonGeneratorLevelGrid2D, TilemapLayersStructureModeGrid2D, ITilemapLayersHandlerGrid2D, ITilemapLayersHandlerGrid2D, GameObject)
Initializes shared tilemaps of a given level.
Declaration
public static void InitializeSharedTilemaps(DungeonGeneratorLevelGrid2D level, TilemapLayersStructureModeGrid2D mode, ITilemapLayersHandlerGrid2D defaultTilemapLayersHandler, ITilemapLayersHandlerGrid2D customTilemapLayersHandler, GameObject example)
Parameters
Type | Name | Description |
---|---|---|
DungeonGeneratorLevelGrid2D | level | Generated level. |
TilemapLayersStructureModeGrid2D | mode | Tilemap layers mode. |
ITilemapLayersHandlerGrid2D | defaultTilemapLayersHandler | Default tilemap layers handler. Used for the Default mode. |
ITilemapLayersHandlerGrid2D | customTilemapLayersHandler | Custom tilemap layers handler. Used for the Custom mode. |
GameObject | example | Example game object for tilemaps structure. Used for the FromExample mode. |
SetTilemapsMaterial(DungeonGeneratorLevelGrid2D, Material)
Sets a given material to all shared tilemap layers.
Declaration
public static void SetTilemapsMaterial(DungeonGeneratorLevelGrid2D level, Material tilemapMaterial)
Parameters
Type | Name | Description |
---|---|---|
DungeonGeneratorLevelGrid2D | level | |
Material | tilemapMaterial |