private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height) { double Closest = pInfo.Point.GetDistance; //Initialized SquarePoint ClosestPoint = pInfo.Point; double InfoOnSqare = Height.GetState(pInfo.Point.X, pInfo.Point.Y); for (int i = 0; i < 8; i++) { SquarePoint Position = pInfo.Pos(i); if (!Position.InUse) { continue; } if (Position.CanWalk) { if (Height.GetState(Position.X, Position.Y) - InfoOnSqare < 3) //<3 { double Distance = Position.GetDistance; if (Closest > Distance) { Closest = Distance; ClosestPoint = Position; } } } } return(ClosestPoint); }
private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height, double currentHeight, Gamemap map, bool pOverride) { double Closest = pInfo.Point.GetDistance; SquarePoint ClosestPoint = pInfo.Point; double InfoOnSqare = Height.GetState(pInfo.Point.X, pInfo.Point.Y, currentHeight); for (int i = 0; i < 8; i++) { SquarePoint Position = pInfo.Pos(i); if (!Position.InUse) continue; double h = Height.GetState(Position.X, Position.Y, currentHeight); if (Position.CanWalk(h) && (!map.SquareOccupied(Position.X, Position.Y, h) || pOverride)) { if (h - InfoOnSqare < 3) //<3 { double Distance = Position.GetDistance; if (Closest > Distance) { Closest = Distance; ClosestPoint = Position; } } } } return ClosestPoint; }
private static SquarePoint GetClosetSqare(SquareInformation pInfo, HeightInfo Height) { double Closest = pInfo.Point.GetDistance; //Initialized SquarePoint ClosestPoint = pInfo.Point; double InfoOnSqare = Height.GetState(pInfo.Point.X, pInfo.Point.Y); for (int i = 0; i < 8; i++) { SquarePoint Position = pInfo.Pos(i); if (!Position.InUse) continue; if (Position.CanWalk) { if (Height.GetState(Position.X, Position.Y) - InfoOnSqare < 3) //<3 { double Distance = Position.GetDistance; if (Closest > Distance) { Closest = Distance; ClosestPoint = Position; } } } } return ClosestPoint; }