コード例 #1
0
    private void GenerateProcedualLevel()
    {
        if (useGraphicAsBase)
        {
            elevationMap = ProcessBaseGraphicIntoArray();
            moistureMap  = ProcessBaseGraphicIntoArray();
            float[] perlinElevation = PerlinMapGenerator.GeneratePerlinMap(mapDimensions.width, mapDimensions.height, elevationSettings, false);
            float[] perlinMoisture  = PerlinMapGenerator.GeneratePerlinMap(mapDimensions.width, mapDimensions.height, moistureSettings, false);
            elevationMap = Utility.AddSameLengthArrays(elevationMap, perlinElevation, perlinWeightOnBaseGrafic);
            elevationMap = Utility.ClampPerlinValues(elevationMap);
            moistureMap  = Utility.AddSameLengthArrays(moistureMap, perlinMoisture, perlinWeightOnBaseGrafic);
            moistureMap  = Utility.ClampPerlinValues(moistureMap);
        }
        else
        {
            elevationMap = PerlinMapGenerator.GeneratePerlinMap(mapDimensions.width, mapDimensions.height, elevationSettings);
            moistureMap  = PerlinMapGenerator.GeneratePerlinMap(mapDimensions.width, mapDimensions.height, moistureSettings);
        }
        terrainMap = CombinePerlinMaps();

        terrainMap = SeedGrowth.PopulateGrid(terrainMap, forestParam, mapDimensions);
        terrainMap = SeedGrowth.PopulateGrid(terrainMap, citiesParam, mapDimensions);

        terrainMap = RoadGenerator.GenerateRoads(terrainMap, riversParam);
        terrainMap = RoadGenerator.GenerateRoads(terrainMap, roadParam);

        InitializePerlinMap();
    }