스토리지

[3.18] 2차원 배열 연습 4 - Isometric View 본문

Unity/수업내용(C#)

[3.18] 2차원 배열 연습 4 - Isometric View

ljw4104 2021. 3. 18. 16:20

using System;

namespace Study07
{
    public class App
    {
        enum eMaterial
        {
            HOUSE = 100
        }
        public App()
        {
            int[,] arr = new int[8, 6];
            arr.Initialize();

            Console.WriteLine("******** 집 건설 전 ********");
            Print(arr);

            Console.WriteLine("\n******** 집 건설 후 ********");

            arr[2, 2] = arr[2, 3] = arr[3, 2] = arr[3, 3] = 100;
            Print(arr);
        }

        private void Print(int[,] arr)
        {
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    Console.Write("{0}\t", (eMaterial)arr[i, j]);
                }
                Console.WriteLine();
            }
        }
    }
}

Comments