Esempio n. 1
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);
        }