public override AbstractFiringPattern Exec()
        {
            double i = start, j = stop, tempRadius = 5;

            firingrate = 65;
            texture    = TextureNames.LaserBullet;

            while (i < j)
            {
                var invis1 = MainContent.ModelFactory.BuildGenericModel(TextureNames.Invisible, start, stop, fromModel.GetLocation(), fromModel);
                invis1.SetOrbitAngle(0);
                invis1.SetSourceModel(fromModel);
                invis1.SetOrbitSpeed(10);
                invis1.SetOrbitRadius(tempRadius);
                MainContent.Events.AddScheduledTaggedEvent(start, stop, fromModel, () => invis1.MoveOrbit());

                var invis2 = MainContent.ModelFactory.BuildGenericModel(TextureNames.Invisible, start, stop, fromModel.GetLocation(), fromModel);
                invis2.SetOrbitAngle(180);
                invis2.SetSourceModel(fromModel);
                invis2.SetOrbitSpeed(10);
                invis2.SetOrbitRadius(tempRadius);
                MainContent.Events.AddScheduledTaggedEvent(start, stop, fromModel, () => invis2.MoveOrbit());

                var t1 = invis1.GetLocation();
                var t2 = invis1.GetLocation();

                //first bullet.
                BulletModel bullet1 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, t1, fromModel);
                bullet1.SetRate(speed);
                bullet1.SetSourceModel(invis1);

                bullet1.SetDestinationModel(MainContent.PlayerShip);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet1.SetLocationFromSourcetModel());
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet1.SetAngleFromDestinationModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet1.MoveLinearAngle());

                //second bullet.
                BulletModel bullet2 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, t2, fromModel);
                bullet2.SetRate(speed);
                bullet2.SetSourceModel(invis2);

                bullet2.SetDestinationModel(MainContent.PlayerShip);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet2.SetLocationFromSourcetModel());
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet2.SetAngleFromDestinationModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet2.MoveLinearAngle());

                i += 1 / firingrate;

                if (tempRadius > 75)
                {
                    continue;
                }
                else
                {
                    tempRadius += .5;
                }
            }

            return(this);
        }
Esempio n. 2
0
        public override AbstractFiringPattern Exec()
        {
            double i = start;

            speed      = 2;
            firingrate = 1000;                      //default firing rate.
            angle      = rnd.Next(0, 360);          //generate random angle for laser.

            while (i < stop)                        //Similar to Laser, just with increasing speed for each subsequent bullet.
            {
                var t = fromModel.GetLocation();
                speed += .5;

                BulletModel bullet = MainContent.ModelFactory.BuildEnemyBulletModel(TextureNames.LaserBullet, i, i + bulletLife, t, fromModel);
                bullet.SetLinearTravelAngle(angle);
                bullet.SetRate(speed);
                bullet.SetSourceModel(fromModel);
                bullet.SetDestinationModel(MainContent.PlayerShip);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet.SetLocationFromSourcetModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet.MoveLinearAngle());


                scheduledEvents.Add(new GameEvents.Event(start, stop, bullet));
                i += 1 / firingrate;
            }

            return(this);
        }
Esempio n. 3
0
        public override AbstractFiringPattern Exec()
        {
            Random rand = new Random();

            for (double i = start; i < stop; i += 1 / firingrate)
            {
                BulletModel bullet = MainContent.ModelFactory.BuildEnemyBulletModel(TextureNames.LaserBullet, i, i + bulletLife, fromModel.GetLocation(), fromModel);
                bullet.SetLinearTravelAngle(rand.Next(360));
                bullet.SetRate(speed);
                bullet.SetSourceModel(fromModel);
                bullet.SetDestinationModel(MainContent.PlayerShip);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet.SetLocationFromSourcetModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet.MoveLinearAngle());


                scheduledEvents.Add(new GameEvents.Event(start, stop, bullet));
            }
            return(this);
        }
        public override AbstractFiringPattern Exec()
        {
            double i = start;

            while (i < stop)
            {
                var t = fromModel.GetLocation();

                BulletModel bullet = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, t, fromModel);
                bullet.SetRate(speed);
                bullet.SetSourceModel(fromModel);
                bullet.SetLinearTravelAngle(angle);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet.SetLocationFromSourcetModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet.MoveLinearAngle());


                scheduledEvents.Add(new GameEvents.Event(start, stop, bullet));
                i += 1 / firingrate;
            }
            return(this);
        }
Esempio n. 5
0
 public override AbstractFiringPattern Exec()
 {
     for (double i = 0; i < 360; i += (360 / spokes))
     {
         double jAngle = i;
         for (double j = start; j < stop; j += 1 / firingrate)
         {
             BulletModel bullet1 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, j, j + 10, fromModel.GetLocation(), fromModel);
             if (bullet1 != null)
             {
                 bullet1.SetLinearTravelAngle(jAngle);
                 bullet1.SetSourceModel(fromModel);
                 bullet1.SetRate(speed);
                 MainContent.Events.AddSingleTaggedEvent(j, fromModel, () => bullet1.SetLocationFromSourcetModel());
                 MainContent.Events.AddScheduledTaggedEvent(j, j + bulletLife, fromModel, () => bullet1.MoveLinearAngle());
                 jAngle += 5 * direction;
                 jAngle %= 360;
             }
             scheduledEvents.Add(new GameEvents.Event(i, i + bulletLife, bullet1));
         }
     }
     return(this);
 }
Esempio n. 6
0
        public override AbstractFiringPattern Exec()
        {
            double jAngle    = startDegree;
            int    direction = 10;

            for (double i = start; i < stop; i += 1 / firingrate)
            {
                BulletModel bullet1 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, fromModel.GetLocation(), fromModel);
                if (bullet1 != null)
                {
                    bullet1.SetLinearTravelAngle(jAngle);
                    bullet1.SetSourceModel(fromModel);
                    bullet1.SetRate(speed);
                    MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet1.SetLocationFromSourcetModel());
                    MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet1.MoveLinearAngle());
                    if (jAngle >= max + Math.Abs(direction) || jAngle <= min - Math.Abs(direction))
                    {
                        direction *= -1;
                    }
                    jAngle += direction;
                }
            }
            return(this);
        }
Esempio n. 7
0
        public override AbstractFiringPattern Exec()
        {
            double i;

            for (i = start; i < stop; i += 1 / firingrate)
            {
                double j = startAngle - 1;
                while (j < stopAngle)
                {
                    BulletModel bullet = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, fromModel.GetLocation(), fromModel);
                    bullet.SetLinearTravelAngle(j);
                    bullet.SetSourceModel(fromModel);
                    bullet.SetRate(speed);
                    bullet.SetDamage(damage);
                    MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet.SetLocationFromSourcetModel());
                    MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet.MoveLinearAngle());

                    j += density;

                    scheduledEvents.Add(new GameEvents.Event(start, stop, bullet));
                }
            }
            return(this);
        }
Esempio n. 8
0
        public override AbstractFiringPattern Exec()
        {
            double i = start;

            texture = TextureNames.LaserBullet;

            var t = fromModel.GetLocation();

            //invis point 1
            var invis1 = MainContent.ModelFactory.BuildGenericModel(TextureNames.Invisible, start,
                                                                    stop, fromModel.GetLocation(), fromModel);

            invis1.SetOrbitAngle(0);
            invis1.SetOrbitRadius(15);
            invis1.SetSourceModel(fromModel);
            invis1.SetOrbitSpeed(0);
            MainContent.Events.AddScheduledTaggedEvent(start, stop, fromModel, () => invis1.MoveOrbit());


            //Invis point 2
            var invis2 = MainContent.ModelFactory.BuildGenericModel(TextureNames.Invisible, start,
                                                                    stop, fromModel.GetLocation(), fromModel);

            invis2.SetOrbitAngle(180);
            invis2.SetOrbitRadius(15);
            invis2.SetSourceModel(fromModel);
            invis2.SetOrbitSpeed(0);
            MainContent.Events.AddScheduledTaggedEvent(start, stop, fromModel, () => invis2.MoveOrbit());

            //bullet 1.
            BulletModel bullet = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, t, fromModel);

            bullet.SetRate(speed);
            bullet.SetSourceModel(fromModel);

            bullet.SetDestinationModel(MainContent.PlayerShip);
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet.SetLocationFromSourcetModel());
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet.SetAngleFromDestinationModel());
            MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet.MoveLinearAngle());

            i += .15;


            //bullets 2 and 3.
            var bullet2 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i,
                                                                         i + bulletLife, invis1.GetLocation(), fromModel);

            bullet2.SetSourceModel(invis1);
            bullet2.SetRate(speed);
            bullet2.SetDestinationModel(MainContent.PlayerShip);
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet2.SetLocationFromSourcetModel());
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet2.SetAngleFromDestinationModel());
            MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet2.MoveLinearAngle());

            var bullet3 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i,
                                                                         i + bulletLife, invis1.GetLocation(), fromModel);

            bullet3.SetSourceModel(invis2);
            bullet3.SetRate(speed);
            bullet3.SetDestinationModel(MainContent.PlayerShip);
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet3.SetLocationFromSourcetModel());
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet3.SetAngleFromDestinationModel());
            MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet3.MoveLinearAngle());

            i += .15;

            //bullets 4 5 and 6
            BulletModel bullet4 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, t, fromModel);

            bullet4.SetRate(speed);
            bullet4.SetSourceModel(fromModel);

            bullet4.SetDestinationModel(MainContent.PlayerShip);
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet4.SetLocationFromSourcetModel());
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet4.SetAngleFromDestinationModel());
            MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet4.MoveLinearAngle());

            var bullet5 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i,
                                                                         i + bulletLife, invis1.GetLocation(), fromModel);

            bullet5.SetSourceModel(invis1);
            bullet5.SetRate(speed);
            bullet5.SetDestinationModel(MainContent.PlayerShip);
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet5.SetLocationFromSourcetModel());
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet5.SetAngleFromDestinationModel());
            MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet5.MoveLinearAngle());

            var bullet6 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i,
                                                                         i + bulletLife, invis1.GetLocation(), fromModel);

            bullet6.SetSourceModel(invis2);
            bullet6.SetRate(speed);
            bullet6.SetDestinationModel(MainContent.PlayerShip);
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet6.SetLocationFromSourcetModel());
            MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet6.SetAngleFromDestinationModel());
            MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet6.MoveLinearAngle());


            return(this);
        }
Esempio n. 9
0
        public override AbstractFiringPattern Exec()
        {
            double i = start, j = stop, tempRadius = 5;

            firingrate = 85;
            texture    = TextureNames.LaserBullet;

            //create invisible orbiting object.

            while (i < j)
            {
                var invis = MainContent.ModelFactory.BuildGenericModel(TextureNames.Invisible, start, stop, fromModel.GetLocation(), fromModel);
                invis.SetOrbitAngle(0);
                invis.SetSourceModel(fromModel);
                invis.SetOrbitSpeed(10);
                invis.SetOrbitRadius(tempRadius);
                MainContent.Events.AddScheduledTaggedEvent(start, stop, fromModel, () => invis.MoveOrbit());

                var t = invis.GetLocation();

                //bullet to shoot at player.
                BulletModel bullet1 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i, i + bulletLife, t, fromModel);
                bullet1.SetRate(speed);
                bullet1.SetSourceModel(invis);

                bullet1.SetDestinationModel(MainContent.PlayerShip);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet1.SetLocationFromSourcetModel());
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet1.SetAngleFromDestinationModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet1.MoveLinearAngle());

                //second bullet shooting at 45 degree angle.
                var bullet2 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i,
                                                                             i + bulletLife, invis.GetLocation(), fromModel);
                bullet2.SetSourceModel(invis);
                bullet2.SetRate(speed);
                bullet2.SetLinearTravelAngle(45);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet2.SetLocationFromSourcetModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet2.MoveLinearAngle());

                //third bullet shooting at 135 degree angle.
                var bullet3 = MainContent.ModelFactory.BuildEnemyBulletModel(texture, i,
                                                                             i + bulletLife, invis.GetLocation(), fromModel);
                bullet3.SetSourceModel(invis);
                bullet3.SetRate(speed);
                bullet3.SetLinearTravelAngle(135);
                MainContent.Events.AddSingleTaggedEvent(i, fromModel, () => bullet3.SetLocationFromSourcetModel());
                MainContent.Events.AddScheduledTaggedEvent(i, i + bulletLife, fromModel, () => bullet3.MoveLinearAngle());


                i += 1 / firingrate;

                if (tempRadius > 75)
                {
                    continue;
                }
                else
                {
                    tempRadius += .5;
                }
            }

            return(this);
        }