private void AddBuildings() { foreach (KeyValuePair <string, BuildingProgress> kvp in BuildingProgress) { BuildingData buildingData = GenericDataLoader.GetData <BuildingData>(kvp.Value.ID); UnitProgress unitProgressForBuilding = UnitProgress[buildingData.Unit]; Buildings.Add(new Building(kvp.Value, unitProgressForBuilding)); } }
public Unit(UnitData i_data, UnitProgress i_progress, ViewModel i_model) { mModel = i_model; mData = i_data; mProgress = i_progress; SetUnitLevel(); SetUnitTraining(); Level.UpgradeCompleteEvent += OnUpgraded; SubscribeToMessages(); }
public Building(BuildingProgress i_buildingProgress, UnitProgress i_unitProgress) { mModel = new ViewModel(); mData = GenericDataLoader.GetData <BuildingData>(i_buildingProgress.ID); Name = mData.GetName(); NumUnits = (int)Math.Floor(i_unitProgress.Count); NextUnitProgress = i_unitProgress.Count - NumUnits; mLevel = new Upgradeable(); mLevel.SetPropertyToUpgrade(mModel, mData.BuildingLevel); mLevel.UpgradeCompleteEvent += OnUpgraded; Level.Value = i_buildingProgress.Level; UnitData unitData = GenericDataLoader.GetData <UnitData>(i_unitProgress.ID); Unit = new Unit(unitData, i_unitProgress, mModel); UpdateViewProperties(); SubscribeToMessages(); }