Esempio n. 1
0
 private void NextDayButton_Click(object sender, EventArgs e)
 {
     if (TimeBoxValue() != 3)
     {
         TimeBoxValue(TimeBoxValue() + 1);
     }
     else
     {
         HealthProgress.Value -= RandomInt(0, 2);
         if (FoodProgress.Value >= 80)
         {
             HealthProgress.Value += RandomInt(2, 5);
         }
         else if (FoodProgress.Value >= 60)
         {
             HealthProgress.Value += RandomInt(0, 2);
         }
         GetDisease();
         HomeBonus();
         TimeBoxValue(0);
         DayBox.Text = (Convert.ToInt32(DayBox.Text) + 1).ToString();
         var stats = new Properties.stats();
         MessageBox.Show(null, "Настал " + DayBox.Text + " день.\nВаш иммунитет изменился на " + (HealthProgress.Value - stats.health) + " ед.\nВаш уровень сытости изменился на " + (FoodProgress.Value - stats.hunger) + " ед.", "Следующий день!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         SaveGame();
     }
 }
Esempio n. 2
0
        private void LoadGame()
        {
            Properties.stats loadsaves = new Properties.stats();
            HealthProgress.Value = loadsaves.health;
            FoodProgress.Value   = loadsaves.hunger;
            MoneyBox.Text        = loadsaves.money.ToString();
            DayBox.Text          = loadsaves.day.ToString();
            TimeBoxValue(loadsaves.time);

            homeid = loadsaves.homeid;
        }
Esempio n. 3
0
 private void SetDefaults()
 {
     Properties.stats stats = new Properties.stats
     {
         health = 80,
         hunger = 70,
         money  = 20.00,
         day    = 1,
         time   = 0
     };
     stats.Save();
 }
Esempio n. 4
0
 private void SaveGame()
 {
     Properties.stats stats = new Properties.stats
     {
         health = HealthProgress.Value,
         hunger = FoodProgress.Value,
         money  = Convert.ToInt32(MoneyBox.Text),
         day    = Convert.ToInt32(DayBox.Text),
         time   = TimeBoxValue(),
         homeid = homeid
     };
     stats.Save();
 }
Esempio n. 5
0
 private void HomeBonus()
 {
     if (homeid == 0 && Try(0.2))
     {
         HealthProgress.Value -= RandomInt(2, 5);
         Properties.stats stats = new Properties.stats();
         MessageBox.Show(null, "Из-за отсутствия дома вы потеряли " + (stats.health - HealthProgress.Value) + " ед. иммунитета", "Плохие условия!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (homeid == 1 && Try(0.05))
     {
         HealthProgress.Value -= RandomInt(1, 3);
         Properties.stats stats = new Properties.stats();
         MessageBox.Show(null, "Из-за плохих условий проживания вы потеряли " + (stats.health - HealthProgress.Value) + " ед. иммунитета", "Плохие условия!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }