rendered paste bodyprivate void RepaintMap()
{
Graphics g = Graphics.FromImage(bufferMap);
PaintMap(g);
DrawUnits(g);
drawTor(g, windSpeed, 40, unitList[1].barrelAngle, unitList[1].getLineToDraw()[1], windDirection);
g.Dispose();
}
public void drawTor(Graphics g, int windSpeed, float startV, double angle, Point initialPosition, WindDirection windDirection)
{
//windSpeed = 10;
int wyV = 0, wxV = 0;
switch (windDirection)
{
case WindDirection.E: wxV = windSpeed; wyV = 0;
break;
case WindDirection.NE: wxV = windSpeed; wyV = windSpeed;
break;
case WindDirection.N: wxV = 0; wyV = windSpeed;
break;
case WindDirection.NW: wxV = -windSpeed; wyV = windSpeed;
break;
case WindDirection.W: wxV = -windSpeed; wyV = 0;
break;
case WindDirection.SW: wxV = -windSpeed; wyV = -windSpeed;
break;
case WindDirection.S: wxV = 0; wyV = -windSpeed;
break;
case WindDirection.SE: wxV = windSpeed; wyV = -windSpeed;
break;
case WindDirection.None: wxV = 0; wyV = 0;
break;
default:
break;
}
for (int time = 0; time < 100; time++)
{
int x1 = (int)(initialPosition.X + (startV * Math.Cos(angle) + wxV) * time);
int y1 = (int)(initialPosition.Y + (startV * Math.Sin(angle) + wyV) * time + (9.81 / 2) * time * time);
//int x2 = (int)(initialPosition.X + (startV * Math.Cos(angle) + wxV) * (time+1));
//int y2 = (int)(initialPosition.Y + (startV * Math.Sin(angle) + wyV) * (time+1) + (9.81 / 2) * time * time);
//g.DrawLine(Pens.Fuchsia,new Point(x1,y1), new Point(x2,y2));
g.DrawEllipse(Pens.Fuchsia, (int)(x1 * mapSize.X / fileMapSize.X) - 2,
(int)(y1 * mapSize.Y / fileMapSize.Y) - 2, 4, 4);
}
}