public static List <List <IntPoint> > GetDefBlowerPoly(BlowerService blower) { //return PolysHelper.GetShapeSquarePoly(blower.PositionXNACenter, (blower.Height + 50)/2); var res = AreaCompPolyHandler.GetBlowerPoly((BlowerService)blower, StaticData.BlowerEffectAreaRadius); List <IntPoint> polyCut = new List <IntPoint>() { new IntPoint(-1000, (int)blower.PositionXNA.Y + StaticData.BlowerEffectAreaRadius), new IntPoint(+1000, (int)blower.PositionXNA.Y + StaticData.BlowerEffectAreaRadius), new IntPoint(+1000, 1000), new IntPoint(-1000, 1000), }; return(EntraSolver.GetPolySolution(res, polyCut, ClipType.ctDifference)); }
public static void AddBumpsAreaForBubble(ref List <List <IntPoint> > initialPoly, BumperEntityPoly bumper, BubbleEntityPoly bubble) { BubbleService bubbleService = bubble.CompObj as BubbleService; Vector2 bubblePos = bubbleService.PositionXNACenter; //var coveredBumps = BumpersHandler.GetCoveredBumpers(bubble, initialPoly); int fR = AreaCompPolyHandler.fR; int nR = AreaCompPolyHandler.nR; int dfR = AreaCompPolyHandler.dfR; //foreach (BumperEntityPoly bumper in coveredBumps) { BumpRigid bump = bumper.CompObj as BumpRigid; Vector2 bPos = bump.PositionXNACenter2D; CookieDirection abDir = AreaCompPolyHandler.GetABCookieDirection(bubblePos, bPos); CookieDirection rlDir = AreaCompPolyHandler.GetRLCookieDirection(bubblePos, bPos); switch (bump.Dir) { case Direction.East: case Direction.West: if (abDir == CookieDirection.FromBottom) { if (rlDir == CookieDirection.FromRight) { initialPoly = EntraSolver.GetPolySolution(initialPoly, new List <IntPoint>() { new IntPoint((int)bPos.X, (int)bPos.Y + 900), new IntPoint((int)bPos.X - fR, (int)bPos.Y + 900), new IntPoint((int)bPos.X - fR, (int)bPos.Y - 900), new IntPoint((int)bPos.X, (int)bPos.Y - 900) }, ClipType.ctUnion); } else { //initialPoly = EntraSolver.GetPolySolution(initialPoly, // new Polygon() // { // new IntPoint((int) bPos.X, // (int) bPos.Y - 900), // new IntPoint((int) bPos.X + fR, // (int) bPos.Y - 900), // new IntPoint((int) bPos.X + fR, // (int) bPos.Y + nR), // new IntPoint((int) bPos.X - 20, // (int) bPos.Y + nR), // new IntPoint((int) bPos.X - 20, // (int) bPos.Y + 20), // }, // ClipType.ctUnion); initialPoly = EntraSolver.GetPolySolution(initialPoly, new List <IntPoint>() { new IntPoint((int)bPos.X, (int)bPos.Y - 900), new IntPoint((int)bPos.X + fR, (int)bPos.Y - 900), new IntPoint((int)bPos.X + fR, (int)bPos.Y + 900), new IntPoint((int)bPos.X, (int)bPos.Y + 900) }, ClipType.ctUnion); } } else { // the bubble is above the bumps so don't add anything } break; case Direction.South: case Direction.North: break; case Direction.NorthWest: case Direction.SouthEast: if (abDir == CookieDirection.FromBottom) // From Right and Left are the same { initialPoly = EntraSolver.GetPolySolution(initialPoly, new List <IntPoint>() { new IntPoint((int)bPos.X, (int)bPos.Y + 900), new IntPoint((int)bPos.X - fR, (int)bPos.Y + 900), new IntPoint((int)bPos.X - fR, (int)bPos.Y - 900), new IntPoint((int)bPos.X, (int)bPos.Y - 900) }, ClipType.ctUnion); } break; case Direction.NorthEast: case Direction.SouthWest: if (abDir == CookieDirection.FromBottom) // From Right and Left are the same { //var poly = new Polygon() // { // new IntPoint((int) bPos.X, (int) bPos.Y - 900), // new IntPoint((int) bPos.X + fR, // (int) bPos.Y - 900), // new IntPoint((int) bPos.X + fR, (int) bPos.Y), // new IntPoint((int) bPos.X, (int) bPos.Y), // }; //EntraDrawer.DrawIntoFile(poly); //initialPoly = EntraSolver.GetPolySolution(initialPoly, // poly, // ClipType.ctUnion); var poly = new List <IntPoint>() { new IntPoint((int)bPos.X, (int)bPos.Y - 900), new IntPoint((int)bPos.X + fR, (int)bPos.Y - 900), new IntPoint((int)bPos.X + fR, (int)bPos.Y + 900), new IntPoint((int)bPos.X, (int)bPos.Y + 900), }; initialPoly = EntraSolver.GetPolySolution(initialPoly, poly, ClipType.ctUnion); EntraDrawer.DrawIntoFile(poly); } break; default: throw new ArgumentOutOfRangeException(); } } }