public float GetHeightForPointForCell(
     Vector2 xzPoint, IHexCell cell, float elevationDuck,
     AsyncTextureUnsafe <Color32> flatlandNoise, AsyncTextureUnsafe <Color32> hillsNoise
     )
 {
     if (cell.Terrain.IsWater())
     {
         return(RenderConfig.SeaFloorElevation);
     }
     if (cell.Shape == CellShape.Flatlands)
     {
         return(FlatlandsHeightmapLogic.GetHeightForPoint(xzPoint, flatlandNoise));
     }
     else if (cell.Shape == CellShape.Hills)
     {
         return(HillsHeightmapLogic.GetHeightForPoint(xzPoint, elevationDuck, flatlandNoise, hillsNoise));
     }
     else if (cell.Shape == CellShape.Mountains)
     {
         return(MountainHeightmapLogic.GetHeightForPoint(xzPoint, cell, elevationDuck, flatlandNoise, hillsNoise));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Exemplo n.º 2
0
        public float GetHeightForPoint(
            Vector2 xzPoint, float elevationDuck, AsyncTextureUnsafe <Color32> flatlandsNoiseTexture,
            AsyncTextureUnsafe <Color32> hillsNoiseTexture
            )
        {
            float hillNoise = NoiseGenerator.SampleNoise(
                xzPoint, hillsNoiseTexture, RenderConfig.HillsElevationNoiseStrength, NoiseType.ZeroToOne
                ).x;

            float hillsHeight = RenderConfig.HillsBaseElevation + hillNoise;

            float flatlandsHeight = FlatlandsHeightmapLogic.GetHeightForPoint(xzPoint, flatlandsNoiseTexture);

            var retval = Mathf.Lerp(hillsHeight, flatlandsHeight, elevationDuck);

            return(retval);
        }