public override AbstractFiringPattern Exec() { double i = 1; var invis1 = MainContent.ModelFactory.BuildGenericModel(TextureNames.Invisible, start, stop, fromModel.GetLocation(), fromModel); invis1.SetSourceModel(fromModel); //MainContent.Events.AddScheduledTaggedEvent(start, stop, fromModel, () => invis1.MoveOrbit()); while (i < 360) { BulletModel bullet = MainContent.ModelFactory.BuildEnemyBulletModel(texture, fromModel.StartLife, fromModel.EndLife, invis1.GetLocation(), fromModel); bullet.SetOrbitAngle(i); bullet.SetSourceModel(invis1); bullet.SetOrbitSpeed(speed); bullet.SetRate(speed); double tag = fromModel.GetHashCode() + "static".GetHashCode(); double middle = (start + stop) / 2; MainContent.Events.AddScheduledTaggedEvent(start, stop, tag, () => bullet.MoveOrbit()); MainContent.Events.AddScheduledTaggedEvent(start, start + 1, tag, () => bullet.IncrementOrbitRadius()); MainContent.Events.AddScheduledTaggedEvent(start + 1, middle, tag, () => bullet.DecrementOrbitRadius()); MainContent.Events.AddScheduledTaggedEvent(middle + 1, stop, tag, () => bullet.ToggleOrbitRate()); MainContent.Events.AddSingleTaggedEvent(start, TextureNames.Invisible, () => invis1.SetLocationFromSourcetModel()); i += density; scheduledEvents.Add(new GameEvents.Event(start, stop, bullet)); } return(this); }
public override AbstractFiringPattern Exec() { double i = 1; while (i < 360) { BulletModel bullet = MainContent.ModelFactory.BuildEnemyBulletModel(texture, start, stop, fromModel.GetLocation(), fromModel); bullet.SetOrbitAngle(i); bullet.SetOrbitRadius(radius); bullet.SetSourceModel(fromModel); bullet.SetOrbitSpeed(speed); int tag = fromModel.GetHashCode() + "static".GetHashCode(); bullet.SetTag(tag); MainContent.Events.AddScheduledTaggedEvent(start, stop, tag, () => bullet.MoveOrbit()); i += density; scheduledEvents.Add(new GameEvents.Event(start, stop, bullet)); } return(this); }