public void SetAllTileIDs(int subGridIndex, int[,] tileIDs, int[,] intWallIDs, int[,] extWallIDs, int[,] roofIDs) { ComponentSubGrid subGrid = grid.GetSubGrid(subGridIndex); if (tileIDs == null && subGrid != null) { tileIDs = new int[subGrid.gridSizeX, subGrid.gridSizeY]; for (int i = 0; i < subGrid.gridSizeX; i++) { for (int j = 0; j < subGrid.gridSizeY; j++) { tileIDs[i, j] = 10002; } } } if (intWallIDs == null && subGrid != null) { intWallIDs = new int[subGrid.gridSizeX, subGrid.gridSizeY]; for (int i = 0; i < subGrid.gridSizeX; i++) { for (int j = 0; j < subGrid.gridSizeY; j++) { intWallIDs[i, j] = 12002; } } } if (extWallIDs == null && subGrid != null) { extWallIDs = new int[subGrid.gridSizeX, subGrid.gridSizeY]; for (int i = 0; i < subGrid.gridSizeX; i++) { for (int j = 0; j < subGrid.gridSizeY; j++) { extWallIDs[i, j] = 12003; } } } if (roofIDs == null && subGrid != null) { roofIDs = new int[subGrid.gridSizeX, subGrid.gridSizeY]; for (int i = 0; i < subGrid.gridSizeX; i++) { for (int j = 0; j < subGrid.gridSizeY; j++) { roofIDs[i, j] = 11000; } } } gridTileIDs.Add(new GridIDs(subGridIndex, tileIDs, intWallIDs, extWallIDs, roofIDs)); }
public int DetermineSubID(ComponentNode node, string side) { ComponentGrid componentGrid = parentWalls.gameObject.GetComponent <ComponentGrid>(); ComponentSubGrid grid = componentGrid.GetSubGrid(subGridIndex); ComponentNode neighbourNode = GetNeighbouringComponentNode(grid, componentGrid.gameObject.name, node); if (node != null) { if (node.doorway == ComponentNode.DoorwayValue.doorway) { return(1); // sub index for left side doorway walls } else if (node.window == ComponentNode.WindowValue.largewindow) { return(2); } else if (node.window == ComponentNode.WindowValue.mediumwindow) { return(3); } else if (node.window == ComponentNode.WindowValue.smallwindow) { return(4); } } if (neighbourNode != null) { if (neighbourNode.doorway == ComponentNode.DoorwayValue.doorway) { return(1); // sub index for left side doorway walls } else if (neighbourNode.window == ComponentNode.WindowValue.largewindow) { return(2); } else if (neighbourNode.window == ComponentNode.WindowValue.mediumwindow) { return(3); } else if (neighbourNode.window == ComponentNode.WindowValue.smallwindow) { return(4); } } return(0); }