using UnityEngine;
using System.Collections.Generic;

public class FloorGenerator
{
    const int Size = 32;
    int MapSize = 32;
    int i = 0;

    int[,] World = new int[32, 32];

    Random r = new Random();
    public int[,] Generate(int x, int y)
    {
        if (World[x, y] != 1)
        {
            World[x, y] = 1;

            if (Globals.pathWidth == 2)
                 if (x - 1 >= 0)
                    World[x - 1, y] = 1;
        }
        else
            return Generate(x - 1, y - 1);

        int to = Random.Range(1, 3);

        switch (to)
        {
            case 0: x--; break;
            case 1: y++; break;
            case 2: x++; break;
            case 3: y--; break;
        }

        i++;
        if (i < Size)
            return Generate(x, y);
        return World;
    }
}
