public int CompareTo(object obj) { ArcPoint temp = (ArcPoint)obj; if (Theta > temp.Theta) { return(1); } return(-1); }
private void Go(Vector2Int origin, int recursion, int visionDistance, double theta1, double theta2) { if (recursion > visionDistance) { return; } else if (recursion <= 0) { return; } List <ArcPoint> circle = Circles[recursion]; int circleSize = circle.Count; bool wasObstacle = false; bool foundClear = false; for (int i = 0; i < circleSize; i++) { ArcPoint point = circle[i]; int pX = origin.x + point.X; int pY = origin.y + point.Y; if (!Board.Contains(pX, pY)) { wasObstacle = true; continue; } if (point.Lagging < theta1 && point.Theta != theta1 && point.Theta != theta2) { continue; } if (point.Leading > theta2 && point.Theta != theta1 && point.Theta != theta2) { continue; } Board.Visible(pX, pY); bool isObstacle = Board.IsObstacle(pX, pY); if (isObstacle == true) { if (wasObstacle == true) { continue; } else if (foundClear == true) { double runEndTheta = point.Leading; double runStartTheta = theta1; if (recursion < visionDistance) { Go(origin, recursion + 1, visionDistance, runStartTheta, runEndTheta); } wasObstacle = true; } else { if (point.Theta == 0.0f) { theta1 = 0.0f; } else { theta1 = point.Leading; } } } else { foundClear = true; if (wasObstacle == true) { ArcPoint last = circle[i - 1]; theta1 = last.Lagging; wasObstacle = false; } else { wasObstacle = false; continue; } } wasObstacle = isObstacle; } if (recursion < visionDistance) { Go(origin, recursion + 1, visionDistance, theta1, theta2); } }
public override bool Equals(object obj) { ArcPoint temp = (ArcPoint)obj; return(Theta == temp.Theta); }