コード例 #1
0
        public PlayerEvolution()
        {
            List <Range <PersonAge> > ranges = _phases
                                               .Select(p => p.AgeRange)
                                               .ToList();

            _ageRange = Range <PersonAge> .MergeRanges(ranges);

            _duration = Duration.FromAgeRange(_ageRange);
        }
コード例 #2
0
        public FeatureImprovementRatio GetImprovementFromAge(PersonAge age)
        {
            CheckRule(new PersonAgeMustBeWithinAgeRangeRule(age, AgeRange));

            // recalculer l'abscisse pour que 0 <= x <= 1
            double x = (age.Years - AgeRange.Lower.Years) / Duration.FromAgeRange(AgeRange).Years;

            // calculer y entre 0 et 1
            double y = Math.Pow(x, EvolutionCurve.Value) * MaxFeatureImprovement.Value;


            return(new FeatureImprovementRatio(y));
        }