コード例 #1
0
ファイル: Test.cs プロジェクト: Ben-Wunderlich/LostValkyrie
    void Start()
    {
        converterInst = GetComponent <GraphToMaze>();
        if (makeMaze)
        {
            return;//will be drawn on second frame anyway
        }
        //Graph g = Mazes.PrimPath(width, height);
        Graph g = Mazes.DfsPath(width, height);

        //Graph g = Mazes.BfsPath(width, height);
        //Graph g = Mazes.BaseGraph(10, 10);
        converterInst.MakeWalls(g, width, height, (0, 0));
        DisplayGraph(g);
    }
コード例 #2
0
ファイル: Test.cs プロジェクト: Ben-Wunderlich/LostValkyrie
    private void Update()
    {
        if (makeMaze)
        {
            makeMaze = false;

            if (mazeSettings.grid)
            {
                Graph grid = Mazes.BaseGraph(width, height);
                DisplayGraph(grid);
                converterInst.MakeWalls(grid, width, height, (0, 0));
            }
            if (mazeSettings.dfs)
            {
                Graph dfs = Mazes.DfsPath(width, height);
                //Graph dfs = Mazes.DfsIter(width, height);
                DisplayGraph(dfs);
                converterInst.MakeWalls(dfs, width, height, (0, 0));
            }
            if (mazeSettings.prims)
            {
                Graph prims = Mazes.PrimPath(width, height);
                DisplayGraph(prims);
                converterInst.MakeWalls(prims, width, height, (0, 0));
            }
            if (mazeSettings.bfs)
            {
                Graph path = Mazes.BfsPath(width, height);
                DisplayGraph(path);
                converterInst.MakeWalls(path, width, height, (0, 0));
            }

            if (!(mazeSettings.dfs || mazeSettings.prims || mazeSettings.grid || mazeSettings.bfs))
            {
                Graph nuall = Mazes.DefaultPath(width, height);
                DisplayGraph(nuall);
                converterInst.MakeWalls(nuall, width, height, (0, 0));
            }
        }
    }