public override bool Upgrade() { bool succ = false; CentralBuilding next = (CentralBuilding)NextUpgrade(); if (next != null) { applyValues(next); Level++; succ = true; } return(succ); }
public void CleanUpCitizens() { foreach (var item in citizen.Citizens) { if (item.House is CentralBuilding) { CentralBuilding c = (CentralBuilding)item.House; ((CentralBuilding)c).Citizens = 0; } } foreach (var item in citizen.Citizens) { if (item.House is CentralBuilding) { CentralBuilding c = (CentralBuilding)item.House; ((CentralBuilding)c).Citizens++; } } }
public void TickUpdate() { int tickValue = r.Next(0, citizenChanceMultiplier); if (tickValue == 1 && citizenChanceCooldownDurationCurrent <= 0) { CentralBuilding c = (CentralBuilding)buildings.Find(x => x is CentralBuilding); if (c.Citizens < c.CitizenCap) { Citizen cit = citizen.GetRandomCitizen(Classes.Citizen.Sex.Male); cit.House = c; c.Citizens++; citizen.Citizens.Add(cit); experience += (int)ExperienceCount.CitizenArrived * level; citizenChanceCooldownDurationCurrent = r.Next((int)(citizenChanceCooldownDuration * 0.6), (int)(citizenChanceCooldownDuration * 1.2)); OnUpdateCitizen?.Invoke(this, new ProgressEventArgs("")); } } if (citizenChanceCooldownDurationCurrent > 0) { citizenChanceCooldownDurationCurrent--; } }