Esempio n. 1
0
 private void Form_BlockLegs(object sender, EventArgs e)
 {
     player.SetBlock(2);
     oponent.GetHit(new Random().Next(0, 3));
     if (player.Block != oponent.Hit)
     {
         player.Hp          -= new Random().Next(7, 10);
         form.textBox1.Text += Environment.NewLine + "Вам нанесли удар в ноги \n";
     }
     else
     {
         form.textBox1.Text += Environment.NewLine + "Удар заблокирован \n";
     }
     if (player.Hp <= 0)
     {
         form.textBox1.Text = "К сожалению, вы проиграли\n";
         Finish();
         form.progressBar1.Value = 0;
     }
     else
     {
         form.progressBar1.Value = player.Hp;
         if (player.Hp < 25)
         {
             ModifyProgressBarColor.SetState(form.progressBar1, 2);
         }
         else
         if (player.Hp < 50)
         {
             ModifyProgressBarColor.SetState(form.progressBar1, 3);
         }
     }
 }
Esempio n. 2
0
 private void Form_HitBody(object sender, EventArgs e)
 {
     player.GetHit(1);
     oponent.SetBlock(new Random().Next(0, 3));
     if (player.Hit != oponent.Block)
     {
         oponent.Hp         -= new Random().Next(7, 10);
         form.textBox1.Text += Environment.NewLine + "Вы попали в корпус \n";
     }
     else
     {
         form.textBox1.Text += Environment.NewLine + "Удар заблокирован \n";
     }
     if (oponent.Hp <= 0)
     {
         form.progressBar2.Value = 0;
         form.textBox1.Text      = "Поздравляю, вы победили\n";
         Finish();
     }
     else
     {
         form.progressBar2.Value = oponent.Hp;
         if (oponent.Hp < 25)
         {
             ModifyProgressBarColor.SetState(form.progressBar2, 2);
         }
         else
         if (oponent.Hp < 50)
         {
             ModifyProgressBarColor.SetState(form.progressBar2, 3);
         }
     }
 }
Esempio n. 3
0
 private void Form_Refresh(object sender, EventArgs e)
 {
     form.count              = 0;
     this.player             = new Player();
     this.oponent            = new Player();
     form.progressBar1.Value = 100;
     form.progressBar2.Value = 100;
     form.textBox1.Text      = "";
     ModifyProgressBarColor.SetState(form.progressBar1, 1);
     ModifyProgressBarColor.SetState(form.progressBar2, 1);
 }