Exemple #1
0
        private DependantStat CreateDependantStat(EntityStat entityStat, List <EntityStat> listForGrowthRates)
        {
            var depStatBase = (DependantStatType)entityStat.StatType;
            var depStat     = new DependantStat(depStatBase, entityStat.GrowthRate);

            foreach (var statTypeDep in depStatBase.StatsDependingOn)
            {
                if (stats.ContainsKey(statTypeDep.StatDependingOn))
                {
                    depStat.AddStatDependency(stats[statTypeDep.StatDependingOn], statTypeDep.StatMultiplier);
                }
                else
                {
                    // could probably be done in a much nicer way
                    // good enough since this should run only once anyway, though it could be problematic
                    // for multiple enemies being spawned
                    // I need the growth rates here of the stats the DependantStat is depending on
                    float    depStatGrowthRate = listForGrowthRates.Find(x => x.StatType == depStatBase).GrowthRate;
                    StatBase statDependency    = new Stat(depStatBase, depStatGrowthRate);

                    stats.Add(statTypeDep.StatDependingOn, statDependency);
                    depStat.AddStatDependency(statDependency, statTypeDep.StatMultiplier);
                }
            }

            return(depStat);
        }
Exemple #2
0
        private int ReturnEntityStatByBaseStatFirst(EntityStat x, EntityStat y)
        {
            var a = x.StatType.GetType() == typeof(DependantStatType) ? 1 : -1;
            var b = y.StatType.GetType() == typeof(DependantStatType) ? 1 : -1;

            return(a - b);
        }