public override System.Collections.IEnumerable TakeTurn() { //Lose food over time. if (Food > 0.0f) { float foodLoss = Player_Char.Consts.FoodLossPerTurn(Strength); Food.Value = Mathf.Max(0.0f, Food - foodLoss); } //If no food is left, lose health over time (i.e. starvation). else { float newHealth = Health - Player_Char.Consts.StarvationDamagePerTurn; if (newHealth <= 0.0f) { Health.Value = 0.0f; TheMap.RemoveUnit(this); yield break; } else { Health.Value = newHealth; } } //Grab the most pressing job and do it. //If no current job exists, find one. if (currentlyDoing == null) { var job = TakeAJob(false); if (job != null) { StartDoingJob(job, null); } } //If we have a job but it isn't an emergency, see if there IS an emergency. else if (!currentlyDoing.IsEmergency) { var emergencyJob = TakeAJob(true); if (emergencyJob != null) { var msg = Localization.Get("INTERRUPT_JOB_EMERGENCY", emergencyJob.ToString()); StartDoingJob(emergencyJob, msg); } } //Perform the current job. if (currentlyDoing != null) { foreach (object o in currentlyDoing.TakeTurn()) { yield return(o); } } }