コード例 #1
0
ファイル: Quadrant.cs プロジェクト: Dyzalonius/MapCommander
    public void GenerateTerrainData()
    {
        // Create noise map
        noiseMap = Noise.GenerateNoiseMap(new Vector2Int(textureSize, textureSize), 0, 300, 1, 0.5f, 1, Vector2.zero);

        // Create color map
        colorMap = new Color[noiseMap.Length];
        for (int y = 0; y < textureSize; y++)
        {
            for (int x = 0; x < textureSize; x++)
            {
                if (x * y > noiseMap.Length)
                {
                    Debug.Log(x + " * " + y + " = " + (x * y));
                }
                colorMap[y * textureSize + x] = new Color(noiseMap[x, y], 0f, 0f);
            }
        }

        if (bottomLeft != null)
        {
            bottomLeft.GenerateTerrainData();
        }
        if (bottomRight != null)
        {
            bottomRight.GenerateTerrainData();
        }
        if (topLeft != null)
        {
            topLeft.GenerateTerrainData();
        }
        if (topRight != null)
        {
            topRight.GenerateTerrainData();
        }
    }
コード例 #2
0
 private void CreateTerrainData()
 {
     root.GenerateTerrainData();
 }