public Game_Timer() { _thread = new Thread(() => { while (true) { //try //{ Game_Time.AddTime(60); if (_reductionParameters >= 3) { int maxNeeds = _need + GameCharacter.NeedsStudy + GameCharacter.NeedsWork; int randomFood = random.Next(1, maxNeeds); int randomMood = random.Next(1, maxNeeds); int randomHealth = random.Next(1, maxNeeds); GameCharacter.ReducingNeeds(randomFood, randomMood, randomHealth); _reductionParameters = 0; } Decrease_Intelligence(); Decrease_Charm(); Decrease_PhysicalDevelopment(); //} //catch (Exception error) //{ // MessageBox.Show(error.Message); //} _reductionParameters += 1; TimePassedGameSecond += 1; Thread.Sleep(_timerSleep); } }); _thread.IsBackground = true; _thread.Start(); }
private void button2_Click(object sender, EventArgs e) { Game_Time.AddTime(2100); }