void NewMap()
    {
        // choose the map
        mapIndex++;
        // generate the map with a random path
        GenerateMap();
        // create a path for the enemies
        // use the pathfinding A* algorithm to reach a target
        PathfindingAStar pathfinder = new PathfindingAStar(grid, currentMap, diagonalWeight, verticalWeight, horizontalWeight);

        // draw the map
        CreateMap(pathfinder.FindPath());
    }
 public void OnEnable()
 {
     script = (PathfindingAStar)target;
 }