using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Board))]
public class BoardEditor : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
Board board = target as Board;
if(GUILayout.Button("배열 요소 출력"))
{
board.PrintBoard();
}
GUILayout.Space(5);
if(GUILayout.Button("각 열에 빈공간 찾기"))
{
board.FindEmptySpaceFromColumn();
}
}
}
public void FindEmptySpaceFromColumn()
{
for(int i = 0; i <board.GetLength(1); i++)
{
int emptySpace = 0;
for(int j = 0; j < board.GetLength(0); j++)
{
Block block = board[j, i];
if(block == null)
{
emptySpace++;
}
}
Debug.Log($"{i}열의 빈공간은 {emptySpace}개 입니다.");
}
}
'Solo > Puzzle' 카테고리의 다른 글
[3Match Puzzle] 각 열에 빈공간 찾기 로직 수 (0) | 2024.06.19 |
---|---|
[3Match Puzzle] 빈공간에 해당하는 위치에 블록 생성하기 (0) | 2024.06.18 |
[3Match Puzzle] GPT를 이용해 출력문 간격 조절 (0) | 2024.06.17 |
[3Match Puzzle] 블록 에디터 만들어서 제거 하기 (0) | 2024.06.17 |
[3Match Puzzle] 메인 카메라 위치 변경 하기 (0) | 2024.06.16 |