public PercentileGrowth GeneratePercentileGrowth(Gender gender) { AbstractPercentileGrowthSet growthSet = _percentileGrowthSetRepository.GetPercentileGrowthSet(gender); if (growthSet == null) { return(null); } List <PercentileGrowth> items = growthSet.Growths.ToList(); return(_listRandomiser.GetRandomisedItem(items)); }
public BodyMassIndex Generate(Country country, Gender playerGender, Percentile percentile, Date dob) { // retrieve game current date DateTime gameDate = _game.CurrentDate; // get player age PersonAge playerAge = PersonAge.FromDate(dob, gameDate); playerAge = playerAge.AsRoundedYears(); // round the value to be able to filter on it. AbstractPercentileGrowthSet growthset = _percentileGrowthSetRepository.GetPercentileGrowthSet(playerGender); PercentileGrowth percentileGrowth = growthset.GetForPercentile(percentile); StatureForAge stature = percentileGrowth.GetStatureForAge(playerAge); WeightForAge weightForAge = percentileGrowth.GetWeightForAge(playerAge); return(new BodyMassIndex(stature.Stature, weightForAge.Mass)); }