public static IAnimatable CreateAnimatable_BugIntro( int index, int startdelay, IIntro intro, Sprite.SpriteTypes spritetype, int wave, int introspeedincrease, bool firemissileonintro, bool isdivebomber = false) { var bug = new Bug(spritetype) { Index = isdivebomber ? -1 : index, Paths = intro.GetPaths(), RotateAlongPath = true, Speed = Constants.BugIntroSpeed + introspeedincrease, StartDelay = startdelay, Started = false, ZIndex = 100, RotatIntoPlaceSpeed = Constants.BugRotateIntoPlaceSpeed, Wave = wave, IsInIntro = true, Intro = intro }; if (firemissileonintro) { bug.MissileCountDowns.Add(Utils.Rnd(1, 10)); } if ((intro as Intro5) != null || (intro as Intro6) != null) { bug.VSpeed = new List <VSpeed> { new VSpeed() { PathPointIndex = 20, Speed = Constants.BugIntroSpeed - 2 }, new VSpeed() { PathPointIndex = 30, Speed = Constants.BugIntroSpeed - 3 } }; } //if ((intro as Intro7) != null || (intro as Intro8) != null) //{ // bug.VSpeed = new List<VSpeed> // { // new VSpeed() // { // PathPointIndex = 10, // Speed = Constants.BugIntroSpeed - 2 // }, // new VSpeed() // { // PathPointIndex = 15, // Speed = Constants.BugIntroSpeed - 3 // } // }; //} switch (spritetype) { case Sprite.SpriteTypes.BlueBug: bug.SpriteBank.Add(new Sprite(Sprite.SpriteTypes.BlueBug_DownFlap)); break; case Sprite.SpriteTypes.RedBug: bug.SpriteBank.Add(new Sprite(Sprite.SpriteTypes.RedBug_DownFlap)); break; case Sprite.SpriteTypes.GreenBug: bug.SpriteBank.Add(new Sprite(Sprite.SpriteTypes.GreenBug_DownFlap)); break; } if (intro.IntroLocation == IntroLocation.Top) { //For bugs dropping from the top, add an offscreen path to make the bug fly in from off screen bug.Paths.Insert(0, new BezierCurve() { StartPoint = new PointF(bug.Paths[0].StartPoint.X, bug.Paths[0].StartPoint.Y - (1000 + bug.StartDelay)), EndPoint = new PointF(bug.Paths[0].StartPoint.X, bug.Paths[0].StartPoint.Y - 50), ControlPoint1 = new PointF(bug.Paths[0].StartPoint.X, bug.Paths[0].StartPoint.Y - 1000), ControlPoint2 = new PointF(bug.Paths[0].StartPoint.X, bug.Paths[0].StartPoint.Y - 50), IsIntroPath = true }); } else if (intro.IntroLocation == IntroLocation.LowerLeft) { //For bugs coming from the left side, add an offscreen path to make the bug fly in from off screen bug.Paths.Insert(0, new BezierCurve() { StartPoint = new PointF(bug.Paths[0].StartPoint.X - (1000 + bug.StartDelay), bug.Paths[0].StartPoint.Y), EndPoint = new PointF(bug.Paths[0].StartPoint.X - 50, bug.Paths[0].StartPoint.Y), ControlPoint1 = new PointF(bug.Paths[0].StartPoint.X - 1000, bug.Paths[0].StartPoint.Y), ControlPoint2 = new PointF(bug.Paths[0].StartPoint.X - 50, bug.Paths[0].StartPoint.Y), IsIntroPath = true }); } else if (intro.IntroLocation == IntroLocation.LowerRight) { //For bugs coming from the right side, add an offscreen path to make the bug fly in from off screen bug.Paths.Insert(0, new BezierCurve() { StartPoint = new PointF(bug.Paths[0].StartPoint.X + (1000 + bug.StartDelay), bug.Paths[0].StartPoint.Y), EndPoint = new PointF(bug.Paths[0].StartPoint.X + 50, bug.Paths[0].StartPoint.Y), ControlPoint1 = new PointF(bug.Paths[0].StartPoint.X + 1000, bug.Paths[0].StartPoint.Y), ControlPoint2 = new PointF(bug.Paths[0].StartPoint.X + 50, bug.Paths[0].StartPoint.Y), IsIntroPath = true }); } if (!intro.IsChallenge) { if (isdivebomber) { bug.IsDiveBomber = true; bug.DiveBombLocation = new PointF(Utils.Rnd(50, Constants.CanvasSize.Width - 50), Constants.CanvasSize.Height + 50); bug.Paths.Last().EndPoint = new PointF(bug.Paths.Last().EndPoint.X, bug.Paths.Last().EndPoint.Y - 100); } else { bug.HomePoint = GetGridPoint(index); } } else { bug.DoLineToLocation = false; } return(bug); }
public static string GetCTaheader(IIntro that) => that.Value <string>("cTAHeader");
public static IPublishedContent GetCTaimage(IIntro that) => that.Value <IPublishedContent>("cTAImage");
public static IHtmlString GetCTabody(IIntro that) => that.Value <IHtmlString>("cTABody");