コード例 #1
0
    public void UpdateMapInEditor()
    {
        MapData mapData = Generator();

        MapDisplay display = FindObjectOfType <MapDisplay>();

        if (mode == DrawMode.Biome)
        {
            display.DisplayTexture(TextureGen.FromBiome(mapData.colorMap, mapSize, mapSize));
        }
        else if (mode == DrawMode.Noise)
        {
            display.DisplayTexture(TextureGen.FromNoiseScale(mapData.noiseMap));
        }
        else if (mode == DrawMode.Mesh)
        {
            MeshData meshData = MeshGen.TerrainMesh(mapData.noiseMap, heightMultiplier, HeightGradiant, LevelOfDetail);
            display.DisplayMesh(meshData, TextureGen.FromBiome(mapData.colorMap, mapSize, mapSize));
            if (addvegetation)
            {
                List <GameObject> spawnedVeget = new List <GameObject>();

                spawnedVeget = VegetationGenerator.PlaceVegetation(mapData.noiseMap, meshData, LevelOfDetail, biomes, density, spawnedVeget);

                spawnedVeget = RaycastSpawning.Adjust(spawnedVeget, InGround);

                spawnedVeget.Clear();
            }
        }
    }
コード例 #2
0
 private void Awake()
 {
     instance = this;
     DontDestroyOnLoad(gameObject);
 }