수정 후
public void FindEmptySpaceFromColumn()
{
arrEmptySpaceCol = new int[width]; //배열 초기화
for (int i = 0; i < width; i++) //열
{
int existBlockCnt = 0;
for (int j = 0; j < totalHeight; j++) //행
{
Block block = board[j, i];
if (block != null)
{
existBlockCnt++;
}
}
int emptySpace = height - existBlockCnt;
arrEmptySpaceCol[i] = emptySpace; // 배열의 인덱스(열)에 emptySpace(카운트)값 할당 => 각 열마다 빈공간의 개수
Debug.Log($"{i}열의 빈공간은 {emptySpace}개 입니다.");
}
}
'Solo > Puzzle' 카테고리의 다른 글
[3Match Puzzle] 스왑 Tool UI (0) | 2024.06.19 |
---|---|
[3Match Puzzle] 각 행에 있는 모든 블록 내려보내기 버튼 생성 (0) | 2024.06.19 |
[3Match Puzzle] 빈공간에 해당하는 위치에 블록 생성하기 (0) | 2024.06.18 |
[3Match Puzzle] 각 열에서 빈공간 찾기 (0) | 2024.06.18 |
[3Match Puzzle] GPT를 이용해 출력문 간격 조절 (0) | 2024.06.17 |