예제 #1
0
    //find a singular zone; subfunction of zone
    void find_zone(int y, int x, Zone z)
    {
        tile t = maze [y, x];

        if (!t.get_touch())
        {
            t.set_zone(z);
            Debug.Log(t.get_zone().get_id());
            t.touch(true);
            z.add_tile(t);

            if (t.get_northwall() == tile.Wall.none)
            {
                find_zone(y - 1, x, z);
            }
            if (t.get_westwall() == tile.Wall.none)
            {
                find_zone(y, x - 1, z);
            }
            if (t.get_eastwall() == tile.Wall.none)
            {
                find_zone(y, x + 1, z);
            }
            if (t.get_southwall() == tile.Wall.none)
            {
                find_zone(y + 1, x, z);
            }
        }
    }