private void WoundEvent(object sender, BattleEventArgs e) { if (existance is User) { progressBar1.Value = e.hp; label5.Text = e.hp.ToString(); } else { progressBar2.Value = e.hp; label4.Text = e.hp.ToString(); } richTextBox1.Text += e.name + " получает ранение в " + getBodyParts(attacked); }
void Attack(Player ex) { Array bodyParts = Enum.GetValues(typeof(BodyParts)); if (ex is User) { attacked = (BodyParts)bodyParts.GetValue(randomGenerator.Next(1, 3)); if (radioButton1.Checked) { ex.setBlock(BodyParts.Head); } if (radioButton2.Checked) { ex.setBlock(BodyParts.Body); } if (radioButton3.Checked) { ex.setBlock(BodyParts.Legs); } } else { if (radioButton1.Checked) { attacked = BodyParts.Head; } if (radioButton2.Checked) { attacked = BodyParts.Body; } if (radioButton3.Checked) { attacked = BodyParts.Legs; } ex.setBlock((BodyParts)bodyParts.GetValue(randomGenerator.Next(1, 3))); } BattleEventArgs e = new BattleEventArgs(ex.Name, ex.Hp); ex.getHit(attacked, e); }
private void DeathEvent(object sender, BattleEventArgs e) { richTextBox1.Text += e.name + " погиб\n"; gameOver(); }
private void BlockEvent(object sender, BattleEventArgs e) { richTextBox1.Text += e.name + " успешно отбил атаку"; }