// Update is called once per frame void Update() { if (isZombie) { zombieLife += Time.deltaTime; Color lerp = Color.LerpUnclamped(originalColor, zombieColor, Min(zombieLife * 12, 1f)); gameObject.GetComponent <Renderer>().material.SetColor("_Color", lerp); if (zombieLife >= zombieLifeLimit) { citizenControl.numZombies--; if (citizenControl.numZombies == 0) { citizenControl.numApocalypse++; int remainingCitizens = citizenControl.getCitizens().Count; if (remainingCitizens > 0) { achievementControl.NotificationUpdate("Survival", "You have survived the zombie apocalypse!"); } else { achievementControl.NotificationUpdate("The Black Plague", "All your citizens have died. May peace be with you."); } if (citizenControl.numApocalypse == 1) { achievementControl.NotificationUpdate("First-Timer", "Survive one zombie apocalypse"); } else if (citizenControl.numApocalypse == 2) { achievementControl.NotificationUpdate("Dual Destiny", "Survive two zombie apocalypse"); } else if (citizenControl.numApocalypse == 3) { achievementControl.NotificationUpdate("Veteran", "Survive three zombie apocalypse"); } else if (citizenControl.numApocalypse == 5) { achievementControl.NotificationUpdate("Untouchable", "Survive FIVE zombie apocalypse"); } } citizenControl.killZombie(this); } } if (action.Update()) { // action completed, get new action action = ActionFactory.getAction(this); if (actionsLeftUntilMatingAllowed > 0) { actionsLeftUntilMatingAllowed--; } } }
public void SaveCity() { CityState state = new CityState(); state.cityName = metrics.getCityName(); state.timeRemaining = metrics.getTimeRemaining(); state.citizens = citizenControl.getCitizens(); state.sidewalks = structureControl.getSidewalks(); state.buildings = structureControl.getBuildings(); state.points = metrics.getNumPoints(); SaveGameToDisk(state); }