コード例 #1
0
        public void setFromValue(float _val)
        {
            val         = _val;
            terrainType = bbTerrainType.LAND;
            float t = Random.Range(0.0f, 1.0f);

            if (val < TERRAIN_LEVEL)
            {
                terrainType = bbTerrainType.OCEAN;
            }
            else if (val > (1 - TERRAIN_LEVEL))
            {
                terrainType = bbTerrainType.MOUNTAIN;
            }
            else if (val > 0.5f)
            {
                float thresh = Mathf.Pow(Mathf.InverseLerp((1 - TERRAIN_LEVEL), 0.5f, val), TERRAIN_RARITY) + TERRAIN_UNCERTAINTY;
                if (t > thresh)
                {
                    terrainFeature = bbTerrainFeature.MINEABLE;
                }
            }
            else if (val < 0.5f)
            {
                float thresh = Mathf.Pow(Mathf.InverseLerp(TERRAIN_LEVEL, 0.5f, val), TERRAIN_RARITY) + TERRAIN_UNCERTAINTY;
                if (t > thresh)
                {
                    terrainFeature = bbTerrainFeature.ARABLE;
                }
            }
        }
コード例 #2
0
 public bbLand(bbPos _pos)
 {
     pos            = _pos;
     terrainFeature = bbTerrainFeature.NONE;
 }