private void DoOneComputerDriverMove(object state) { uint nrBacktracks; Point gridPoint; mComputerDriverManager.GetNextGridPoint(mActiveTrack, mActiveCar, mRouteGridPoints, new Point(GridLinePainter.GetMiddleGridPointX(xMyCanvas), GridLinePainter.GetMiddleGridPointY(xMyCanvas)), out nrBacktracks, out gridPoint); if (nrBacktracks == 0) { if (gridPoint != null) { HandleGridPoint(gridPoint); } } else { for (uint index = 0; index < nrBacktracks; index++) { RemoveLastMovementVector(); } if (gridPoint != null) { HandleGridPoint(gridPoint); } } }
/// <summary> /// Paint starting line candidate so that user knows where to start /// </summary> private void PaintStartingLineCandidate() { uint startingLineYCoordinate = GridLinePainter.GetMiddleGridRowYCoordinate(xMyCanvas); uint startingLineXRightGridPoint = GridLinePainter.GetMiddleGridPointX(xMyCanvas); double startingLineXRightCoordinate = startingLineXRightGridPoint * GridBackgroundHelper.gridDistance; mStartingLineCandidateLeftPoint.X = 0.0; mStartingLineCandidateLeftPoint.Y = startingLineYCoordinate; mStartingLineCandidateRightPoint.X = startingLineXRightCoordinate; mStartingLineCandidateRightPoint.Y = startingLineYCoordinate; Line startingLineCandidate = new Line(); startingLineCandidate.Stroke = TrackBrushDefs.startingLineBrush; startingLineCandidate.StrokeThickness = 3; startingLineCandidate.X1 = mStartingLineCandidateLeftPoint.X; startingLineCandidate.Y1 = mStartingLineCandidateLeftPoint.Y; startingLineCandidate.X1 = mStartingLineCandidateRightPoint.X; startingLineCandidate.Y2 = mStartingLineCandidateRightPoint.Y; Canvas.SetZIndex(startingLineCandidate, ZIndexValues.startingLine); xMyCanvas.Children.Add(startingLineCandidate); }