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;

            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.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());


                scheduledEvents.Add(new GameEvents.Event(start, stop, bullet));
                i += 1 / firingrate;
            }
            return(this);
        }
Esempio n. 3
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. 4
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);
        }