Ejemplo n.º 1
0
    Brick ConvertToBrick(BrickImportItem importedBrickItem)
    {
        Brick convertedBrick = null;

        for (int z = 0; z < workGrid.gridSize.z; z++)
        {
            for (int y = 0; y < workGrid.gridSize.y; y++)
            {
                for (int x = 0; x < workGrid.gridSize.x; x++)
                {
                    if (workGrid.cells[x, y, z].position == new Vector3Int(importedBrickItem.brickPosX, importedBrickItem.brickPosZ, importedBrickItem.brickPosY)) // swap y and z for rhino to unity!
                    {
                        convertedBrick = new Brick(workGrid.cells[x, y, z], importedBrickItem.rotation);
                    }
                }
            }
        }
        convertedBrick.childCells = workGrid.GetChildren(convertedBrick);

        return(convertedBrick);
    }