Beispiel #1
0
        public void SetStructure(BlockStructure structure)
        {
            ClearMatrix();
            BlockPart[,] croppedMatrix = structure.GetCroppedMatrix();
            if (structure.RowsCropped > Rows)
            {
                for (; structure.RowsCropped > Rows;)
                {
                    AddRow();
                    handler.UpdateHandlerPosition(Rows, Columns);
                }
            }

            if (structure.ColsCropped > Columns)
            {
                for (; structure.ColsCropped > Columns;)
                {
                    AddCol();
                    handler.UpdateHandlerPosition(Rows, Columns);
                }
            }
            for (int row = 0; row < structure.RowsCropped; row++)
            {
                for (int col = 0; col < structure.ColsCropped; col++)
                {
                    if (croppedMatrix[row, col] != null)
                    {
                        matrix[row][col].GetComponent <Toggle>().isOn = true;
                    }
                }
            }
        }