Example #1
0
 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);
 }
Example #2
0
        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);
        }
Example #3
0
 private void DeathEvent(object sender, BattleEventArgs e)
 {
     richTextBox1.Text += e.name + " погиб\n";
     gameOver();
 }
Example #4
0
 private void BlockEvent(object sender, BattleEventArgs e)
 {
     richTextBox1.Text += e.name + " успешно отбил атаку";
 }