public static HeightMap GenerateHeightMap(int width, int height, HeightMapSettings settings, Vector2 sampleCenter)
    {
        float[,] values = NoiseCreator.NoiseMapGenerator(width, height, settings.noiseSettings, sampleCenter);
        AnimationCurve heightCurve_threadsafe = new AnimationCurve(settings.heightCurve.keys);

        float minValue = float.MinValue;
        float maxValue = float.MaxValue;

        for (int i = 0; i < width; i++)
        {
            for (int j = 0; j < height; j++)
            {
                values[i, j] *= heightCurve_threadsafe.Evaluate(values[i, j]) * settings.heightMultiplier;
                if (values[i, j] > maxValue)
                {
                    maxValue = values[i, j];
                }
                if (values[i, j] < minValue)
                {
                    minValue = values[i, j];
                }
            }
        }
        return(new HeightMap(values, minValue, maxValue));
    }
Exemplo n.º 2
0
    public void go()
    {
        creator = gameObject.AddComponent<NoiseCreator>();
        planetSurfaceCreator = gameObject.AddComponent<PlanetSurfaceNoise> ();

        maxDistFromStar = distanceScale * 10 * 20; //* 10 planets per star * 20
        updateUniverse (true, true, true);

        spawnPlayer ();
    }
 private void OnEnable()
 {
     creator = target as NoiseCreator;
     Undo.undoRedoPerformed += RefreshCreator;
 }