public void GetShootForceAndAngle(ref int x, ref int y, int bombId, int minTime, int maxTime, int bombCount, float time, ref int force, ref int angle) { if (minTime >= maxTime) { return; } BallInfo ballInfo = BallMgr.FindBall(bombId); if (this.m_game != null && ballInfo != null) { Map map = this.m_game.Map; Point shootPoint = this.GetShootPoint(); float num = (float)(x - shootPoint.X); float num2 = (float)(y - shootPoint.Y); float af = map.airResistance * (float)ballInfo.DragIndex; float f = map.gravity * (float)ballInfo.Weight * (float)ballInfo.Mass; float f2 = map.wind * (float)ballInfo.Wind; float m = (float)ballInfo.Mass; for (float num3 = time; num3 <= 4f; num3 += 0.6f) { double num4 = Living.ComputeVx((double)num, m, af, f2, num3); double num5 = Living.ComputeVy((double)num2, m, af, f, num3); if (num5 < 0.0 && num4 * (double)this.m_direction > 0.0) { double num6 = Math.Sqrt(num4 * num4 + num5 * num5); if (num6 < 2000.0) { force = (int)num6; angle = (int)(Math.Atan(num5 / num4) / 3.1415926535897931 * 180.0); if (num4 < 0.0) { angle += 180; break; } break; } } } x = shootPoint.X; y = shootPoint.Y; } }
public void GetShootForceAndAngle(ref int x, ref int y, int bombId, int minTime, int maxTime, int bombCount, float time, ref int force, ref int angle) { if (minTime < maxTime) { BallInfo ballInfo = BallMgr.FindBall(bombId); if (this.m_game != null && ballInfo != null) { Map map = this.m_game.Map; Point sp = this.GetShootPoint(); float dx = (float)(x - sp.X); float dy = (float)(y - sp.Y); float arf = map.airResistance * (float)ballInfo.DragIndex; float gf = map.gravity * (float)ballInfo.Weight * (float)ballInfo.Mass; float wf = map.wind * (float)ballInfo.Wind; float mass = (float)ballInfo.Mass; for (float t = time; t <= 4f; t += 0.6f) { double vx = Living.ComputeVx((double)dx, mass, arf, wf, t); double vy = Living.ComputeVy((double)dy, mass, arf, gf, t); if (vy < 0.0 && vx * (double)this.m_direction > 0.0) { double tf = Math.Sqrt(vx * vx + vy * vy); if (tf < 2000.0) { force = (int)tf; angle = (int)(Math.Atan(vy / vx) / 3.1415926535897931 * 180.0); if (vx < 0.0) { angle += 180; } break; } } } x = sp.X; y = sp.Y; } } }