예제 #1
0
    void colorMaze()
    {
        List <Cell> path = SolutionAlgorithms.getLongestPath(maze, distances);

        goal = path[0]; root = path[path.Count - 1];

        Cell furthestCell = SolutionAlgorithms.getMax(maze, distances);
        int  furthestDist = distances[(int)furthestCell.y, (int)furthestCell.x];

        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                maze[y, x].transform.Find("Floor").GetComponent <Renderer>().material.color = Color.Lerp(Color.white, material.color, (float)distances[y, x] / furthestDist);
            }
        }
    }
예제 #2
0
    public void updateLengthText()
    {
        Cell temp = SolutionAlgorithms.getMax(mazeGenerator.maze, mazeGenerator.distances);

        lengthText.text = "Longest Path Length: " + mazeGenerator.distances[temp.y, temp.x];
    }