public void setNumCitizens(int num) { numCitizens = num; displayNumCitizens(); if (num == 10 || num == 100 || num == 250 || num == 500 || num == 1000) { achievementControl.NotificationUpdate("Achievement Unlocked: " + num.ToString() + " citizens", "Earning this award means " + num.ToString() + " citizens have been created in your city"); } if (num == 2000) { achievementControl.NotificationUpdate("Disgusting!", "You have created a city with 2000 citizens"); } }
// 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--; } } }