コード例 #1
0
    //Called by UI script when Build button is pressed
    public void BuildMaze(int r, int c, int algorithm)
    {
        //destroy the previous maze
        foreach (Transform t in mazeContainer.transform)
        {
            Destroy(t.gameObject);
        }

        //rows and columns from input
        rows    = r;
        columns = c;

        //set the number of cells in the maze
        grid = new MazeCell[rows, columns];

        //create grid with walls and floor
        Builder();

        //Use algorthm from input
        UseAlgorithmFromInput(algorithm);

        //call the method to reset the camera position
        CameraFollow camera = Camera.main.GetComponent <CameraFollow>();

        camera.CameraReset();
    }