/// <summary> /// Set nr of vectors and paint candidate grid points on starting line /// </summary> private void InitRace() { // clear the route mRouteGridPoints.Clear(); xNrVectors.Text = GetNrOfVectors().ToString(); // remove the driven route to start again for (int index = 0; index < mRouteElements.Count; index++) { xMyCanvas.Children.Remove(mRouteElements[index]); } mRouteElements.Clear(); // remove the current candidate grid points cgpp.RemoveCurrentCandidateGridPoints(xMyCanvas.Children); // now mark the candidate grid points for the next move IList <Point> candidateGridPoints = mActiveTrack.GetStartingLinePoints(); cgpp.MarkCandidateGridPoints(xMyCanvas.Children, candidateGridPoints); SetStatusField(StateHelper.startRaceString); mRaceState = StateHelper.RaceState.Manual; xDriveModeSelection.SelectedIndex = 0; xDriveModeSelection.IsEnabled = true; }
private void FinishRace() { mRaceState = StateHelper.RaceState.Finished; mComputerDriverManager.Stop(); xDriveModeSelection.IsEnabled = false; SetStatusField(StateHelper.endRaceString); HandleNrOfVectors4FinishedRace(GetNrOfVectors()); }
private void StopComputerDriver() { mComputerDriverManager.Stop(); mRaceState = StateHelper.RaceState.Manual; SetStatusField(StateHelper.humanInDriversSeatString); }
private void StartComputerDriver() { mRaceState = StateHelper.RaceState.ComputerDriver; SetStatusField(StateHelper.computerInDriversSeatString); mComputerDriverManager.Start(MyTimerCallback); }