Beispiel #1
0
        /// <summary>
        /// add for map's editor
        /// </summary>
        /// <param name="type">v:vie,m:missile,p:power,b:bomb,a:asteroide,c:comet,default:sun</param>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="spawn"></param>
        public void Add(char type, float X, float Y, int spawn)
        {
            int x = (int)(X * WindoW), y = (int)(Y * WindowH);
            ovnis ov = new ovnis();

            switch (type)
            {
                case 'v':
                    ov.rectangle = new Rectangle(x, y, width1, height1);
                    ov.circle.R = R1;
                    ov.FrameLine = 1;
                    break;
                case 'm':
                    ov.rectangle = new Rectangle(x, y, width1, height1);
                    ov.circle.R = R1;
                    ov.FrameLine = 1;
                    break;
                case 'p':
                    ov.rectangle = new Rectangle(x, y, width1, height1);
                    ov.circle.R = R1;
                    ov.FrameLine = 1;
                    break;
                case 'b':
                    ov.rectangle = new Rectangle(x, y, width1, height1);
                    ov.circle.R = R1;
                    ov.FrameLine = 1;
                    break;
                case 'a':
                    ov.rectangle = new Rectangle(x, y, width2, height2);
                    ov.circle.R = R2;
                    ov.FrameLine = 1;
                    break;
                case 'c':
                    ov.rectangle = new Rectangle(x, y, width3, height3);
                    ov.circle.R = R3;
                    ov.FrameLine = 8;
                    break;
                default:
                    ov.rectangle = new Rectangle(x, y, width4, height4);
                    ov.circle.R = R4;
                    ov.FrameLine = 7;
                    break;
            }
            ov.circle.x = ov.rectangle.Center.X;
            ov.circle.Y = ov.rectangle.Center.Y;
            ov.type = type;
            ov.launch = spawn;
            ovni.Add(ov);
        }
Beispiel #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);
 }