Esempio n. 1
0
        internal static float _MTBDaysOfDisease(this BiomeDef _this, IncidentDef diseaseInc)
        {
            var cachedDiseaseCommonalities = _this.cachedDiseaseCommonalities();

            if (cachedDiseaseCommonalities == null)
            {
                cachedDiseaseCommonalities = new Dictionary <IncidentDef, float>();
                for (int i = 0; i < _this.diseases().Count; i++)
                {
                    cachedDiseaseCommonalities.Add(_this.diseases()[i].diseaseInc, _this.diseases()[i].mtbDays);
                }
                foreach (IncidentDef current in DefDatabase <IncidentDef> .AllDefs)
                {
                    if (current.diseaseBiomeRecords != null)
                    {
                        for (int index = 0; index < current.diseaseBiomeRecords.Count; ++index)
                        {
                            if (current.diseaseBiomeRecords[index].biome.defName == _this.defName)
                            {
                                cachedDiseaseCommonalities.Add(current.diseaseBiomeRecords[index].diseaseInc, current.diseaseBiomeRecords[index].mtbDays);
                            }
                        }
                    }
                }
                _this.cachedDiseaseCommonalitiesSet(cachedDiseaseCommonalities);
            }
            float result;

            if (cachedDiseaseCommonalities.TryGetValue(diseaseInc, out result))
            {
                return(result);
            }
            return(9999999f);
        }