public void DrawMap()
    {
        List <Vector3> treePoints = ResourceGeneration.GenerateResourcePoints(treeDistance, meshFilter.sharedMesh.vertices, meshFilter.gameObject, Vector3.zero, heightMapSettings);

        foreach (Vector3 location in treePoints)
        {
            GameObject treeAsset   = FindObjectOfType <TerrainGenerator>().resourcePool.tree;
            GameObject createdTree = Object.Instantiate(treeAsset, location, treeAsset.transform.rotation, meshFilter.gameObject.transform) as GameObject;
            createdTrees.Add(createdTree);
        }
    }
Exemple #2
0
    void GenerateResourceNodes()
    {
        if (hasResources)
        {
            return;
        }

        Vector3[] vertices           = meshFilter.mesh.vertices;
        Vector3   gameObjectPosition = meshObject.transform.position;

        ThreadedDataRequester.RequestData(() => ResourceGeneration.GenerateResourcePoints(20f, vertices, meshObject, gameObjectPosition, heightMapSettings), PlaceTrees);

        hasResources = true;

        /*for (int i = 0; i < chunkSize; i++)
         * {
         *  for (int j = 0; j < chunkSize; j++)
         *  {
         *      int index = i * chunkSize + j;
         *      // Debug.Log("Index (" + index + ") = " + vertices[index]); // TODO Figure out what to do with these vertex cords... they are in world space... grab a distance around them and see if slope (in all 8 directions) is crazy? probably.
         *  }
         * } */
    }