public void CalculateNeighborhoodBiomePresence()
    {
        int groupCellBonus = 2;
        int cellCount      = groupCellBonus;

        TerrainCell groupCell = Group.Cell;

        float totalPresence = groupCell.GetBiomePresence(BiomeId) * groupCellBonus;

        foreach (TerrainCell c in groupCell.Neighbors.Values)
        {
            totalPresence += c.GetBiomePresence(BiomeId);
            cellCount++;
        }

        _neighborhoodBiomePresence = totalPresence / cellCount;

        if ((_neighborhoodBiomePresence < 0) || (_neighborhoodBiomePresence > 1))
        {
            throw new System.Exception("Neighborhood Biome Presence outside range: " + _neighborhoodBiomePresence);
        }
    }
예제 #2
0
 public override float Calculate(TerrainCell cell)
 {
     return(cell.GetBiomePresence(_biomeId));
 }
예제 #3
0
 public override bool Evaluate(TerrainCell cell)
 {
     return(cell.GetBiomePresence(_biomeId) >= MinValue);
 }