void Start()
    {
        _utils = new TerrainHeight();

        _terrain     = GetComponent <Terrain>();
        _resolutionX = _terrain.terrainData.heightmapWidth;
        _resolutionZ = _terrain.terrainData.heightmapHeight;
        _heights     = _terrain.terrainData.GetHeights(0, 0, _resolutionX, _resolutionZ);

        ResetHeight();
        ResetColor();

        //StartCoroutine(ChangeHeight());
    }
Beispiel #2
0
 public void ConfigChunkData()
 {
     sideLength = setting.MapSideLength;
     chunkSize  = setting.ChunkSize;
     chunks     = new MapChunk[setting.mapDimension, setting.mapDimension];
     TerrainHeight.Noise(ref noiseHeights, setting.MapSideVertices, setting.seed, setting.octaves, setting.persistance, setting.lacunarity, setting.noiseScale, setting.offset);
     for (int x = 0; x < setting.mapDimension; x++)
     {
         for (int y = 0; y < setting.mapDimension; y++)
         {
             Vector2Int offset = new Vector2Int(x * setting.chunkMesh, y * setting.chunkMesh);
             TerrainHeight.Evaluate(out float[,] chunkHeights, ref noiseHeights, offset, setting.ChunkVertices, setting.mapScale, setting.mapHeight, setting.heightCurve);
             chunks[x, y] = new MapChunk(chunkHeights, setting.chunkMesh, offset, setting.mapScale);
         }
     }
 }
Beispiel #3
0
    public void FourthTest()
    {
        Generator gen = new Generator();

        float[,] noise = Noise.GenerateNoiseMap(gen.seed, gen.worldWidth, gen.worldHeight, gen.noiseScale,
                                                gen.octaves, gen.persistance, gen.lacunarity, gen.offset,
                                                gen.terrainMask, gen.terrainMaskStrenght);

        TerrainHeight terrainHeight = new TerrainHeight();

        gen.heightRules.Add(terrainHeight);
        BiomeObject biomeObject = ScriptableObject.CreateInstance <BiomeObject>();

        gen.biomeObjects.Add(biomeObject);
        TerrainTemp terrainTemp = new TerrainTemp();

        gen.temperatureRules.Add(terrainTemp);
        gen.GenerateTerrain();
        Assert.That(gen.biomeLayer != null, Is.EqualTo(true));
    }
Beispiel #4
0
 /// <summary>
 /// Used for basic initialization
 /// </summary>
 public void Initialize(Node left, Node right, Node down, Node up, int y, int x, TerrainHeight height)
 {
     this.up = up;
     this.right = right;
     this.down = down;
     this.left = left;
     this.height = height;
     this.y = y;
     this.x = x;
     myCharacter = null;
 }
Beispiel #5
0
 public Node()
 {
     up = null;
     right = null;
     down = null;
     left = null;
     this.height = TerrainHeight.Unassigned;
     this.myCharacter = null;
 }