워리어 콤보 모작 개발일지

워리어콤보 개발일지 - 2차원 배열 출력

다모아 2023. 9. 14. 21:04

using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;

public class TestMain : MonoBehaviour
{
    private int[,] str =
    {
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 1, 1, 1, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0},
        {0, 0, 0, 0, 0, 0, 0}
    };

    // Start is called before the first frame update
    void Start()
    {
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < 7; i++)
        {
            for(int j = 0; j < 7; j++)
            {
                sb.Append($"{str[i, j]}, ");
            }
            sb.Append("\n");
        }
        Debug.Log(sb.ToString());
    }

}