public void DoLastStepOfTownLoaded() { for (int i = 0; i < AllBuilding.Count; i++) { AllBuilding.ElementAt(i).Value.TownBuildingLastStep(); } }
/// <summary> /// This is used only when loading a town and needs to redo DimOnMap /// </summary> internal void RedoDimAndResaveAllBuildings() { for (int i = 0; i < AllBuilding.Count; i++) { AllRegFile[i].DimOnMap = ReturnDimOnMap(AllBuilding.ElementAt(i).Value.Anchors); ResaveOnRegistro(AllRegFile[i], AllBuilding.ElementAt(i).Value, true); } }
internal List <string> StringOfAllBuildingsHType() { List <string> res = new List <string>(); for (int i = 0; i < AllBuilding.Count; i++) { res.Add(AllBuilding.ElementAt(i).Value.HType + ""); } return(res); }
internal Vector3 AverageOfAllBuildingsNow() { Vector3 sum = new Vector3(); for (int i = 0; i < AllBuilding.Count; i++) { sum += AllBuilding.ElementAt(i).Value.transform.position; } return(sum / AllBuilding.Count); }
internal void DoEquealPaymentForAllWorks() { List <string> res = new List <string>(); for (int i = 0; i < AllBuilding.Count; i++) { if (BuildingWindow.isAWorkBuild(AllBuilding.ElementAt(i).Value)) { AllBuilding.ElementAt(i).Value.DollarsPay = 5; } } }
/// <summary> /// a list string of all the building types that are a work /// </summary> /// <returns></returns> internal List <string> StringOfAllBuildingsThatAreAWork() { List <string> res = new List <string>(); for (int i = 0; i < AllBuilding.Count; i++) { if (BuildingWindow.isAWorkBuild(AllBuilding.ElementAt(i).Value)) { res.Add(AllBuilding.ElementAt(i).Value.HType + ""); } } return(res); }
/// <summary> /// All the positions in all work buildings /// </summary> /// <returns></returns> internal int MaxPositions() { int res = 0; for (int i = 0; i < AllBuilding.Count; i++) { if (BuildingWindow.isAWorkBuild(AllBuilding.ElementAt(i).Value)) { res += AllBuilding.ElementAt(i).Value.MaxPeople; } } return(res); }
/// <summary> /// todo... /// to be used only when loading a brand new Terra Spawner file /// /// if spawnedData is in the closest9 regions will check if needs to remove itself bz /// could fall into a building /// </summary> /// <param name="spawnedData"></param> /// <param name="closest9"></param> internal void MarkTerraIfNeeded(SpawnedData spawnedData, List <RegionD> closest9) { var index = closest9.FindIndex(a => a.Region == spawnedData.Region); if (index == -1) { return; } for (int i = 0; i < AllBuilding.Count; i++) { AllBuilding.ElementAt(i).Value.CheckOnMarkTerra(); } }
/// <summary> /// Created for GC reasons Im not updating the invetory in buildings as changes anymore /// Call when saving a game /// /// Will get the info from all buildings and will update it into AllRegFiles only Prop specified in ResaveOnRegistro() /// are being resaved /// </summary> internal void ResaveAllBuildings() { var error = 0; for (int i = 0; i < AllBuilding.Count; i++) { if (AllBuilding.ElementAt(i).Value.MyId == AllRegFile[i].MyId) { ResaveOnRegistro(AllRegFile[i], AllBuilding.ElementAt(i).Value, false); } //means that somehow are not in sync //this happens only when destroyed a bulding befofre finished built //still on game and save else { error++; var build = AllBuilding.First(a => a.Value.MyId == AllRegFile[i].MyId); ResaveOnRegistro(AllRegFile[i], build.Value, false); } } Debug.Log("Margin error ReSaving: " + error); }