public void CalculNbEventMax() { PoliceStationType policeStationType = (PoliceStationType)_ctx.BuildingTypes[8]; int totalNbVehicule = 0; for (int i = 0; i < policeStationType.List.Count; i++) { PoliceStation p = (PoliceStation)policeStationType.List[i]; totalNbVehicule += p.NbVehicule; } if (totalNbVehicule < 2) { NbEventMax = 3; } else if (totalNbVehicule >= 2 || totalNbVehicule <= 4) { NbEventMax = 7; } else { NbEventMax = 15; } }
public override void CreateInstance(int x, int y, ResourcesManager resources, Map map) { if (!resources.CheckResourcesNeeded(this)) { throw new ArgumentException("Ressources manquantes."); } resources.UpdateWhenCreate(this); Building building = new PoliceStation(this, x, y); map.AddBuilding(x, y, building); _list.Add(building); }