public void setProperties(DungeonAssetModule dungeonAsset, Utils.Orientation orientation) { this.orientation = orientation; this.dungeonAsset = dungeonAsset; if (orientation == Utils.Orientation.horizontal) { spriteRenderer.sprite = dungeonAsset.spriteDoorFrontOpen; boxCollider.size = new Vector2(2, 0.2f); } else { spriteRenderer.sprite = dungeonAsset.spriteDoorSideOpen; boxCollider.size = new Vector2(0.2f, 2); } }
public static bool drawRoom(DungeonAssetModule dungeonAsset, Vector2Int origin, RoomProperty property, Utils.GlobalDirection direction) { //TODO add logic for room rotation DungeonDrawer.dungeonAsset = dungeonAsset; CellState[,] cells = generateCells(property); //Ground and Collider draw try { for (int x = 0; x < property.basicDim.x; x++) { for (int y = 0; y < property.basicDim.y; y++) { switch (cells[x, y]) { case CellState.emptyCell: placeTileCollider(new Vector3Int(origin.x + x, origin.y + y, 0), dungeonAsset.dungeonTiles.groundBase); break; case CellState.groundCell: placeTileGround(new Vector3Int(origin.x + x, origin.y + y, 0), dungeonAsset.dungeonTiles.groundBase); break; } } } //Wall draw for (int x = 0; x < property.basicDim.x; x++) { for (int y = 0; y < property.basicDim.y; y++) { // switch (cells[x, y]) // { // } } } } catch (NullReferenceException ex) { } return(true); }
private void Awake() { dungeonAsset = GameObject.FindObjectOfType <DungeonAssetModule>(); }