private void CalculateScaleOffset(Chunk chunk, float topographySeed, Vector2 neighbourPosition, ref float scale, ref Vector2 offset)
    {
        Biome b = NearnestNeighbourBiome.Calculate(neighbourPosition);

        scale  = b.topographyScaleOffset;
        offset = new Vector2(-chunk.transform.position.x / Chunk.chunkSize * scale,
                             -chunk.transform.position.y / Chunk.chunkSize * scale);
    }
    public void CheckNeighbourBiome(Chunk chunk, Biome[] neighboursBiomes, Dictionary <Vector3, Chunk> visibleChunks)
    {
        Chunk neighbourChunk;

        for (int i = 0; i < chunk.Neighbours4Chunks.Length; i++)
        {
            if (visibleChunks.TryGetValue(chunk.Neighbours4Chunks[i].position, out neighbourChunk))
            {
                neighboursBiomes[i] = chunk.TerrainBiome;
            }
            else
            {
                neighboursBiomes[i] = NearnestNeighbourBiome.Calculate(chunk.Neighbours4Chunks[i].position);
            }
        }
    }
    public bool CheckNeighbourScaleTheSame(Chunk chunk, Dictionary <Vector3, Chunk> visibleChunks)
    {
        Chunk neighbourChunk;
        Biome biome;

        for (int i = 0; i < chunk.Neighbours4Chunks.Length; i++)
        {
            visibleChunks.TryGetValue(chunk.Neighbours4Chunks[i].position, out neighbourChunk);
            if (neighbourChunk != null)
            {
                biome = neighbourChunk.TerrainBiome;
            }
            else
            {
                biome = NearnestNeighbourBiome.Calculate(chunk.Neighbours4Chunks[i].position);
            }
            if (biome.topographyScaleOffset != chunk.TerrainBiome.topographyScaleOffset)
            {
                return(false);
            }
        }
        return(true);
    }
    //private static float riverSeed = 774788;

    //private float RiverNoise(float x, float y, float scale, float seed, Chunk chunk)
    //{
    //    float river = Mathf.PerlinNoise((topographySeed + x) / Chunk.chunkSize * 0.2f + chunk.offsetRiver.x,
    //(topographySeed + y) / Chunk.chunkSize * 0.2f + chunk.offsetRiver.y);
    //    river = river * 2 - 1;
    //    river = river + river * 0.8f;
    //    river = Mathf.Abs(river) - 1;
    //    return (river <= -0.95f) ? river : 0;
    //}

    public void CheckMembershipToBiome(Chunk chunk)
    {
        chunk.TerrainBiome = NearnestNeighbourBiome.Calculate(chunk.transform.position);
    }