public float GetNeighborhoodBiomeTypePresence(BiomeTerrainType type) { float presence = GetBiomeTypePresence(type); foreach (TerrainCell nCell in Neighbors.Values) { presence += nCell.GetBiomeTypePresence(type); } return(presence); }
public float GetBiomeTypePresence(BiomeTerrainType type) { float typePresence = 0; for (int i = 0; i < PresentBiomeIds.Count; i++) { Biome biome = Biome.Biomes[PresentBiomeIds[i]]; if (biome.TerrainType == type) { typePresence += BiomePresences[i]; } } return(typePresence); }
public CellBiomeTypePresenceCondition(Match match) { string type = match.Groups["type"].Value; switch (type) { case "land": TerrainType = BiomeTerrainType.Land; break; case "water": TerrainType = BiomeTerrainType.Water; break; case "ice": TerrainType = BiomeTerrainType.Ice; break; default: throw new System.ArgumentException("Unknown biome terrain type: " + type); } if (!string.IsNullOrEmpty(match.Groups["value"].Value)) { string valueStr = match.Groups["value"].Value; if (!MathUtility.TryParseCultureInvariant(valueStr, out MinValue)) { throw new System.ArgumentException("CellBiomeTypePresenceCondition: Min value can't be parsed into a valid floating point number: " + valueStr); } if (!MinValue.IsInsideRange(DefaultMinValue, CulturalKnowledge.ScaledMaxLimitValue)) { throw new System.ArgumentException("CellBiomeTypePresenceCondition: Min value is outside the range of " + DefaultMinValue + " and 1: " + valueStr); } } else { MinValue = DefaultMinValue; } }
public NeighborhoodBiomeTypePresenceFactor(Match match) { string type = match.Groups["type"].Value; switch (type) { case "land": TerrainType = BiomeTerrainType.Land; break; case "water": TerrainType = BiomeTerrainType.Water; break; case "ice": TerrainType = BiomeTerrainType.Ice; break; default: throw new System.ArgumentException("Unknown biome terrain type: " + type); } }