示例#1
0
        /// <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;
        }
示例#2
0
        private void FinishRace()
        {
            mRaceState = StateHelper.RaceState.Finished;
            mComputerDriverManager.Stop();
            xDriveModeSelection.IsEnabled = false;
            SetStatusField(StateHelper.endRaceString);

            HandleNrOfVectors4FinishedRace(GetNrOfVectors());
        }
示例#3
0
 private void StopComputerDriver()
 {
     mComputerDriverManager.Stop();
     mRaceState = StateHelper.RaceState.Manual;
     SetStatusField(StateHelper.humanInDriversSeatString);
 }
示例#4
0
 private void StartComputerDriver()
 {
     mRaceState = StateHelper.RaceState.ComputerDriver;
     SetStatusField(StateHelper.computerInDriversSeatString);
     mComputerDriverManager.Start(MyTimerCallback);
 }