Ejemplo n.º 1
0
        public TerrainNoise(TerrainType terrainType, int seed, Tools.Accessing.NoiseParameters noiseParameters, Tools.Accessing.CanyonParameters canyonParameters, float noisefrequency = 1)
        {
            this.terrainType      = terrainType;
            this.seed             = seed;
            this.noiseParameters  = noiseParameters;
            this.canyonParameters = canyonParameters;
            Frequency             = noisefrequency;

            fnoise = new FastNoise(seed);

            //Debugging
            if (terrainType == TerrainType.CustomCayonNoise)
            {
                if (canyonParameters == null)
                {
                    BlockedByError = true;
                    error          = new TerrainNoiseError("The TerrainNoise cannot return any value, the canyonParameters equals null.", TerrainNoiseError.ErrorTypes.Error);
                }
                if (canyonParameters.sectionsLength.Length == 0)
                {
                    BlockedByError = true;
                    error          = new TerrainNoiseError("The TerrainNoise cannot return any value, the canyonParameters has no keys.", TerrainNoiseError.ErrorTypes.Error);
                }
            }
            if (noiseParameters.octaves == 0)
            {
                BlockedByError = true;
                error          = new TerrainNoiseError("The TerrainNoise cannot return any value, the noiseParameters has no octaves.", TerrainNoiseError.ErrorTypes.Error);
            }
        }
Ejemplo n.º 2
0
        public void ChangeTerrainType(TerrainType terrainType, Tools.Accessing.NoiseParameters noiseParameters)
        {
            BlockedByError       = false;
            this.terrainType     = terrainType;
            this.seed            = seed;
            this.noiseParameters = noiseParameters;

            fnoise = new FastNoise(seed);

            //Debugging
            if (terrainType == TerrainType.CustomCayonNoise)
            {
                BlockedByError = true;
                error          = new TerrainNoiseError("The TerrainNoise cannot return any value, the noise requires cayonParameters.", TerrainNoiseError.ErrorTypes.Error);
            }
            if (noiseParameters.octaves == 0)
            {
                BlockedByError = true;
                error          = new TerrainNoiseError("The TerrainNoise cannot return any value, the noiseParameters has no octaves.", TerrainNoiseError.ErrorTypes.Error);
            }
        }