public static SC2APIProtocol.Point ToButtomLeftPoint(this System.Drawing.Point self, int worldHeight, float scale = 1.0f) { SC2APIProtocol.Point p = new SC2APIProtocol.Point(); p.X = (self.X * scale); p.Y = ((worldHeight - self.Y) * scale); return(p); }
public static float Dist(this SC2APIProtocol.Point p1, float x, float y) { float dx = p1.X - x; float dy = p1.Y - y; return((float)Math.Sqrt(dx * dx + dy * dy)); }
public static Point2D ToPoint2D(this SC2APIProtocol.Point p1) { Point2D ret = new Point2D(); ret.X = p1.X; ret.Y = p1.Y; return(ret); }
public static void DrawUnits(Graphics g, int gameY, float scale, List <Unit> units, ToDebugBitmapOption option = null) { foreach (Unit u in units) { Pen pen = penWhite; switch (u.Alliance) { case Alliance.Enemy: pen = penRed; break; case Alliance.Neutral: pen = penGreen; break; case Alliance.Self: pen = penBlue; break; } System.Drawing.Point myPoint = u.Pos.ToTopLeftPoint(gameY, scale); if (u.DisplayType == DisplayType.Snapshot) { pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; g.DrawCircle(pen, myPoint.X, myPoint.Y, u.Radius * scale); pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; } else { g.DrawCircle(pen, myPoint.X, myPoint.Y, u.Radius * scale); } if (option != null) { if (option.flgDrawTarget) { foreach (var o in u.Orders) { Pen targetPen = pen; SC2APIProtocol.Point targetPoint = o.TargetWorldSpacePos; if (o.TargetUnitTag != 0) { Unit targtUint = units.GetUnit(o.TargetUnitTag); if (targtUint != null) { targetPen = penWhite; targetPoint = targtUint.Pos; } } if (targetPoint != null) { System.Drawing.Point drawTargetPoint = targetPoint.ToTopLeftPoint(gameY, scale); if (targetPen == penWhite) { g.DrawCircle(targetPen, myPoint.X, myPoint.Y, 2); } targetPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; g.DrawLine(targetPen, myPoint, drawTargetPoint); targetPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; } } } } } }
public MapManager(Ground[,] mapGrid, Point mainBaseCenterLocation = null) { MapGrid = mapGrid; if (mainBaseCenterLocation != null) { _startLocation = mainBaseCenterLocation; // Store location of mainbase (5x5 size) StoreNewBuilding(mainBaseCenterLocation, 5, 5); } }
public void StoreNewBuilding(Point location, double width, double height) { StoreNewBuilding(location.X, location.Y, width, height); }
public static System.Drawing.Point ToTopLeftPoint(this SC2APIProtocol.Point self, int worldHeight, float scale = 1.0f) { return(new System.Drawing.Point((int)(self.X * scale), (int)((worldHeight - self.Y) * scale))); }
public static System.Drawing.Point ToPoint(this SC2APIProtocol.Point self, float scale = 1.0f) { return(new System.Drawing.Point((int)(self.X * scale), (int)(self.Y * scale))); }
public static float Dist(this SC2APIProtocol.Point p1, SC2APIProtocol.Point p2) { return(p1.Dist(p2.X, p2.Y)); }