/* * Do work on a task given the member who's working on it's morale. * Called once per second by Employee update function */ public bool Work(int morale) { if (DependentCompleted && !Completed) { // task progress = morale/5 (=1 if progress is <1) if (morale > 100 || morale < 0) { throw new System.Exception("Morale should not exceed 100 or be below 0. Morale was " + morale + "."); } int progress = morale / 5; if (progress <= 1) { progress = 1; } Completion += progress; Revenue.Earn(progress); if (Completion >= 100) { Completion = 100; Completed = true; Revenue.CompleteTask(); } } return(Completed); }