public void GenerateMap()
    {
        treesOnTheScene.Clear();
        treesOnFire.Clear();
        foreach (Transform child in TreesParent.transform)
        {
            DestroyImmediate(child.gameObject);
        }

        MapDisplay display = FindObjectOfType <MapDisplay>();

        float[,] heightMap = DecodeFloatTexture(terrainMap);
        float[,] roadMask  = DecodeFloatTexture(roadMap);
        display.DrawMesh(MeshGenerator.GenerateTerrainMesh(heightMap, roadMask, passes, level), terrainMap);

        List <Temp> result = ForestGenerator.GenerateTreeLocations(percentage, heightMap, trees.Length);

        GameObject[] temps = new GameObject[trees.Length];
        for (int i = 0; i < trees.Length; i++)
        {
            temps[i] = Instantiate(trees[i], Vector3.zero, Quaternion.identity, TreesParent.transform);
        }

        for (int i = 0; i < result.Count; i++)
        {
            Temp temp = result[i];
            if (roadMask[(int)temp.pos.x, (int)temp.pos.z] > .5f)
            {
                continue;
            }
            GameObject parent = Instantiate(emptyGameObjectPrefab, temp.pos, Quaternion.identity, TreesParent.transform);


            bool     next     = false;
            MeshData meshData = MeshGenerator.CombineMeshData(
                temps[temp.type].GetComponent <MeshFilter>().mesh,
                trees[temp.type].GetComponent <MeshFilter>().sharedMesh,
                temp.pos,
                trees[temp.type].transform.localScale,
                out next
                );

            temps[temp.type].GetComponent <MeshFilter>().mesh = meshData.CreateMesh();

            meshData = null;
            if (next)
            {
                Debug.Log("Next");
                temps[temp.type] = Instantiate(trees[temp.type], Vector3.zero, Quaternion.identity, TreesParent.transform);
            }

            GameObject burntIcon = Instantiate(burntIconPrefab.gameObject, parent.transform);
            GameObject fire      = Instantiate(firePrefab.gameObject, parent.transform);

            ForestTree forestTree = new ForestTree(burntIcon, fire, BurnTime, SpreadSpeed);
            treesOnTheScene.Add(forestTree);
        }

        foreach (ForestTree forestTree in treesOnTheScene)
        {
            foreach (ForestTree otherForestTree in treesOnTheScene)
            {
                if (forestTree == otherForestTree)
                {
                    continue;
                }
                float dist = Vector3.Distance(otherForestTree.burntIcon.transform.position, forestTree.burntIcon.gameObject.transform.position);
                if (dist < MaxDistanceToSpreadFire)
                {
                    forestTree.closestTrees.Add(otherForestTree);
                }
            }
        }
    }