public BuildingLevels CalculatePossibleBuildings(BuildingLevels oldLevels, TimeSpan timeSpan) { var hqLevel = oldLevels.GetValueOrDefault("main", (short)20); var result = new BuildingLevels(); // Get all valid building types for this world by name foreach (var buildingType in BuildingStats.BuildingTypes.Where(t => BuildingStats.LevelOneBuildTimes[t].Ticks > 0)) { String buildingName = buildingType.ToString().ToLower(); short currentLevel = oldLevels.GetValueOrDefault(buildingName, (short)0); short possibleLevels = CalculateLevelsInTimeSpan(buildingType, hqLevel, currentLevel, timeSpan); result[buildingName] = (short)(currentLevel + possibleLevels); } return(result); }
public override void OnReset() { // Manual Singletons PropertyManager.CreateInstance(); BuffQueue.CreateInstance(); EventManager.CreateInstance(); TurnCounter.CreateInstance(); TurnCounter.Instance.OnNewTurn += BuffQueue.Instance.OnNewTurn; MapManager.CreateInstance(Resources.Load <MapDescSobj>("Map/Map0")); // Scriptable Objects PropFactorList = Resources.Load <TurnFactorList>("Event/PropertyFactor"); CatasFactorList = Resources.Load <TurnFactorList>("Event/CatastropheFactor"); LoadBuildingSobjs(); LoadEventSobjs(); LoadTreeItemSobjs(); InitBuildingSobjs(); InitEventSobjs(); InitTreeItemSobjs(); // Building Levels BuildingLevels.CreateInstance(BuildingDict); }