Exemplo n.º 1
0
        private string GetBiome(RealmTile tile)
        {
            if (tile.PolygonId == -1)
            {
                return("unknown");
            }
            if (tile.TileId == RealmTileTypes.Road)
            {
                return("road");
            }
            if (tile.TileId == RealmTileTypes.Water)
            {
                return("river");
            }
            MapPolygon poly = map.Polygons[tile.PolygonId];

            if (tile.TileId == 0xb4)
            {
                return("towel");
            }

            if (beaches.Contains(poly))
            {
                return("beach");
            }
            if (poly.IsWater)
            {
                if (poly.IsCoast)
                {
                    return("coast");
                }
                if (poly.IsOcean)
                {
                    return("ocean");
                }
                return("water");
            }
            if (tile.Elevation >= elevationThreshold[3])
            {
                if (tile.Moisture > moistureThreshold[4])
                {
                    return("snowy");
                }
                return("mountain");
            }
            if (tile.Elevation > elevationThreshold[2])
            {
                if (tile.Moisture > moistureThreshold[4])
                {
                    return("dryland");
                }
                if (tile.Moisture > moistureThreshold[2])
                {
                    return("taiga");
                }
                return("desert");
            }
            if (tile.Elevation > elevationThreshold[1])
            {
                if (tile.Moisture > moistureThreshold[4])
                {
                    return("forest");
                }
                if (tile.Moisture > moistureThreshold[2])
                {
                    return("shrub");
                }
                return("desert");
            }
            if (tile.Moisture > moistureThreshold[4])
            {
                return("rainforest");
            }
            if (tile.Moisture > moistureThreshold[3])
            {
                return("forest");
            }
            if (tile.Moisture > moistureThreshold[2])
            {
                return("grassland");
            }
            return("desert");
            //return "unknown";
        }
Exemplo n.º 2
0
        private RealmTerrainType GetBiomeTerrain(RealmTile tile)
        {
            if (tile.PolygonId == -1 ||
                tile.TileId == RealmTileTypes.Road ||
                tile.TileId == RealmTileTypes.Water)
            {
                return(RealmTerrainType.None);
            }
            MapPolygon poly = map.Polygons[tile.PolygonId];

            if (!poly.IsWater && beaches.Contains(poly))
            {
                return(RealmTerrainType.ShoreSand);
            }
            if (poly.IsWater)
            {
                return(RealmTerrainType.None);
            }
            if (tile.Elevation >= elevationThreshold[3])
            {
                return(RealmTerrainType.Mountains);
            }
            if (tile.Elevation > elevationThreshold[2])
            {
                if (tile.Moisture > moistureThreshold[4])
                {
                    return(RealmTerrainType.HighPlains);
                }
                if (tile.Moisture > moistureThreshold[2])
                {
                    return(RealmTerrainType.HighForest);
                }
                return(RealmTerrainType.HighSand);
            }
            if (tile.Elevation > elevationThreshold[1])
            {
                if (tile.Moisture > moistureThreshold[4])
                {
                    return(RealmTerrainType.MidForest);
                }
                if (tile.Moisture > moistureThreshold[2])
                {
                    return(RealmTerrainType.MidPlains);
                }
                return(RealmTerrainType.MidSand);
            }
            if (poly.Neighbour.Any(_ => beaches.Contains(_)))
            {
                if (tile.Moisture > moistureThreshold[2])
                {
                    return(RealmTerrainType.ShorePlains);
                }
            }

            if (tile.Moisture > moistureThreshold[3])
            {
                return(RealmTerrainType.LowForest);
            }
            if (tile.Moisture > moistureThreshold[2])
            {
                return(RealmTerrainType.LowPlains);
            }
            return(RealmTerrainType.LowSand);
            //return TerrainType.None;
        }