public void FinishedRace() { // stop allowing control for the vehicle canControl = false; brake = 1; motor = 0; // set a flag so it's easy to tell when we are done raceControl.RaceFinished(); }
public void CompletedLap(int anID) { // if should already have an entry in race laps, let's just increment it raceLaps[anID] = (int)raceLaps[anID] + 1; // here, we check to see if this player has finished the race or not (by checking its entry in // raceLaps against our totalLaps var) and if it has finished, we set its entry in raceFinished hashtable // to true. note that we always have to declare the object's type when we get it from the hashtable, since // hashtables store objects of any type and the system doesn't know what they are unless we tell it! if ((int)raceLaps[anID] == totalLaps) { raceFinished[anID] = true; // tell the race controller for this ID that it is finished racing tempRC = (RaceController)raceControllers [anID]; tempRC.RaceFinished(); } }