public string CheckCoordinate(Point coordinates) { if (CoordinateInLandingAreaXAxis(coordinates)) { if (CoordinateInLandingAreaYAxis(coordinates)) { if (!CheckCoordinateValidity(coordinates)) { return(ClashMessage); } ; var pointInUnits = GetCoordinatesInUnits(coordinates); CheckedCoordinatesList.Add(pointInUnits); return(OkMessage); } } if (coordinates._x <= LandingArea.TopLeftCoordinate._x || coordinates._x >= LandingArea.TopRightCoordinate._x) { if (coordinates._y <= LandingArea.TopRightCoordinate._y || coordinates._y >= LandingArea.TopLeftCoordinate._y) { if (!CheckCoordinateValidity(coordinates)) { return(ClashMessage); } ; var pointInUnits = GetCoordinatesInUnits(coordinates); CheckedCoordinatesList.Add(pointInUnits); return(OutOfPlatformMessage); } } return(string.Empty); bool CoordinateInLandingAreaYAxis(Point coordinate) => coordinate._y >= LandingArea.TopRightCoordinate._y && coordinate._y <= LandingArea.BottomRightCoordinate._y; bool CoordinateInLandingAreaXAxis(Point coordinate) => coordinate._x >= LandingArea.TopLeftCoordinate._x && coordinate._x <= LandingArea.TopRightCoordinate._x; }
public void ClearLandedRockets() => CheckedCoordinatesList.Clear();