//aux function of timer decreasing fatigue of workers private void auxBreak(Worker peon, TextBox text) { int rand = randomize(1, 3); int surplus = 0; if (text.IsEnabled == false) { if (peon.fatigue < 100) peon.fatigue = peon.fatigue + rand; } if (peon.fatigue > 100) // peons cannot have fatigue more than 100 { surplus = peon.fatigue; surplus = surplus - 100; peon.fatigue = peon.fatigue - surplus; } }
//aux function of timer increasing fatigue of workers private void auxFatigue(Worker someone, TextBox text, int dec) { if (text.IsEnabled == true) { someone.fatigue = Convert.ToInt32(text.Text); someone.fatigue = someone.fatigue - dec; text.Text = Convert.ToString(someone.fatigue); } }
//aux function to check if worker is faint private void isFaint(Worker someone) { if(someone.fatigue <= 0) { loggedOut(); btLogout.IsEnabled = false; btLogin.IsEnabled = true; MessageBox.Show("" + someone + " fainted. You have been logged out!"); } }