示例#1
0
        private void modif(int spawn, string type)
        {
            if (type == "IA_K")
            {
                couple cople = new couple();
                cople.vie = int.Parse(textBox4.Text);
                cople.speed = int.Parse(textBox5.Text);
                cople.damage = int.Parse(textBox12.Text);
                cople.X = savefile.ia_Kamikaze[spawn].X;
                cople.Y = savefile.ia_Kamikaze[spawn].Y;
                savefile.ia_Kamikaze[spawn] = cople;
                manage_k.remove_all();
                for (int i = 0; i < savefile.ia_Kamikaze.Count; i++)
                    manage_k.Add(cople, i);
            }
            else if (type == "b")
            {
                Bonus bonu = new Bonus();
                bonu.speed = int.Parse(textBox17.Text);
                bonu.angle = int.Parse(textBox18.Text);
                bonu.launch = savefile.bonus[spawn].launch;
                bonu.X = openX;
                bonu.Y = openY;
                char types = savefile.bonus[spawn].type;
                if (radioButton3.Checked)
                    types = 'v';
                else if (radioButton4.Checked)
                    types = 'b';
                else if (radioButton5.Checked)
                    types = 'm';
                else if (radioButton6.Checked)
                    types = 'p';
                else if (radioButton7.Checked && textBox18.BackColor == System.Drawing.Color.Green &&
            textBox17.BackColor == System.Drawing.Color.Green)
                {
                    if (radioButton8.Checked)
                        types = 'a';
                    else if (radioButton9.Checked)
                        types = 'c';
                    else if (radioButton10.Checked)
                        types = 's';
                }
                bonu.type = types;
                savefile.bonus[spawn] = bonu;
                ovni.remove_all();
                for (int i = 0; i < savefile.bonus.Count; ++i)
                    ovni.Add(savefile.bonus[i].type, savefile.bonus[i].X, savefile.bonus[i].Y, i);
            }
            else
            {
                quaintuplet quaint = new quaintuplet();
                quaint.color = new Microsoft.Xna.Framework.Color(color2.R, color2.G, color2.B, color2.A);
                quaint.damage = int.Parse(textBox13.Text);
                quaint.firerate = int.Parse(textBox6.Text);
                quaint.nombre = int.Parse(textBox3.Text);
                quaint.seconde = seconde;
                quaint.speed = int.Parse(textBox2.Text);
                quaint.trajectory = (string)comboBox4.SelectedItem;
                quaint.vie = int.Parse(textBox1.Text);

                quaint.bullet_Speed = int.Parse(textBox15.Text);

                if (type == "IA_V")
                {
                    quaint.X = savefile.ia_viseur[spawn].X;
                    quaint.Y = savefile.ia_viseur[spawn].Y;
                    savefile.ia_viseur[spawn] = quaint;
                    manage_V.remove_all();
                    for (int i = 0; i < savefile.ia_viseur.Count; ++i)
                        manage_V.Add(savefile.ia_viseur[i], i);
                }
                else if (type == "IA_T")
                {
                    quaint.X = savefile.ia_tireur[spawn].X;
                    quaint.Y = savefile.ia_tireur[spawn].Y;
                    savefile.ia_tireur[spawn] = quaint;
                    manage_T.remove_all();
                    for (int i = 0; i < savefile.ia_tireur.Count; ++i)
                        manage_T.Add(savefile.ia_tireur[i], i);
                }

            }
        }
示例#2
0
 /// <summary>
 /// add pour SEU
 /// </summary>
 /// <param name="type">v:vie,m:missile,p:power,b:bomb,a:asteroide,c:comet,default:sun</param>
 /// <param name="time"></param>
 /// <param name="speed"></param>
 /// <param name="angle"></param>
 /// <param name="X"></param>
 public void Add(Bonus bonus)
 {
     Random rnd = new Random();
     ovnis ov = new ovnis();
     int x = (int)(bonus.X * WindoW);
     int speedx = rnd.Next(1, 11), speedy = rnd.Next(1, 11);
     int speedx2 = (int)(Math.Cos((bonus.angle * Math.PI) / 180) * bonus.speed),
         speedy2 = (int)(Math.Sin(bonus.angle * Math.PI / 180) * bonus.speed);
     if (speedx2 == 0)
     {
         speedx2 = fc;
     }
     switch (bonus.type)
     {
         case 'v':
             ov.vie = 1;
             ov.rectangle = new Rectangle(x, -height1 - 2, width1, height1);
             ov.circle.R = R1;
             ov.speedX = speedx;
             ov.speedY = speedy;
             ov.FrameLine = 1;//hharf
             break;
         case 'm':
             ov.miss = 1;
             ov.rectangle = new Rectangle(x, -height1 - 2, width1, height1);
             ov.circle.R = R1;
             ov.speedX = speedx;
             ov.speedY = speedy;
             ov.FrameLine = 1;//harff
             break;
         case 'p':
             ov.power = 1;
             ov.rectangle = new Rectangle(x, -height1 - 2, width1, height1);
             ov.circle.R = R1;
             ov.speedX = speedx;
             ov.speedY = speedy;
             ov.FrameLine = 1;// harf
             break;
         case 'b':
             ov.bomb = 1;
             ov.rectangle = new Rectangle(x, -height1 - 2, width1, height1);
             ov.circle.R = R1;
             ov.speedX = speedx;
             ov.speedY = speedy;
             ov.FrameLine = 1; // harff
             break;
         case 'a':
             ov.damage = 30;
             ov.rectangle = new Rectangle(x, -height2 - 2, width2, height2);
             ov.circle.R = R2;
             ov.speedX = speedx2;
             ov.speedY = speedy2;
             ov.FrameLine = rnd.Next(1, 6);
             switch (ov.FrameLine)
             {
                 case 1:
                     ov.maxframecolumn = 25;
                     break;
                 case 2:
                     ov.maxframecolumn = 19;
                     break;
                 default:
                     ov.maxframecolumn = 20;
                     break;
             }
             break;
         case 'c':
             ov.damage = 60;
             ov.rectangle = new Rectangle(x, -height3 - 2, width3, height3);
             ov.circle.R = R3;
             ov.speedX = speedx2;
             ov.speedY = speedy2;
             ov.FrameLine = rnd.Next(8, 10);
             ov.maxframecolumn = 30;
             break;
         default:
             ov.damage = 100;
             ov.circle.R = R4;
             ov.rectangle = new Rectangle(x, -height3 - 2, width4, height4);
             ov.speedX = speedx2;
             ov.speedY = speedy2;
             ov.FrameLine = rnd.Next(6, 8);
             ov.maxframecolumn = 30;
             break;
     }
     ov.launch = bonus.launch;
     ov.type = bonus.type;
     ovni.Add(ov);
 }
示例#3
0
 private void button16_Click(object sender, EventArgs e)
 {
     if (spawn == -1)
     {
         Bonus bonus;
         char type = '\0';
         if (radioButton3.Checked)
             type = 'v';
         else if (radioButton4.Checked)
             type = 'b';
         else if (radioButton5.Checked)
             type = 'm';
         else if (radioButton6.Checked)
             type = 'p';
         else if (radioButton7.Checked && textBox18.BackColor == System.Drawing.Color.Green &&
     textBox17.BackColor == System.Drawing.Color.Green)
         {
             if (radioButton8.Checked)
                 type = 'a';
             else if (radioButton9.Checked)
                 type = 'c';
             else if (radioButton10.Checked)
                 type = 's';
             bonus.speed = int.Parse(textBox17.Text);
             bonus.angle = int.Parse(textBox18.Text);
         }
         if (type != '\0')
         {
             ovni.Add(type, openX, openY, ovni.ovni.Count);
             bonus = new Bonus();
             bonus.type = type;
             bonus.launch = seconde;
             bonus.X = openX;
             bonus.Y = openY;
             savefile.bonus.Add(bonus);
             hidou();
         }
     }
     else
         modif(spawn, ia_type);
 }