void RegisterCheckpoint(Checkpoint.CheckpointType type) { if (finishedRace || goingWrongway) { return; } switch (type) { case Checkpoint.CheckpointType.Speedtrap: if (RaceManager.instance._raceType != RaceManager.RaceType.SpeedTrap) { return; } //add to the cars total speed speedRecord += GetComponent <Car_Controller>().currentSpeed; //play a sound and show info if (gameObject.tag == "Player") { SoundManager.instance.PlaySound("checkpoint", true); if (RaceManager.instance.showRaceInfoMessages) { RaceUI.instance.StartCoroutine(RaceUI.instance.ShowRaceInfo("+ " + GetComponent <Car_Controller>().currentSpeed + " mph", 1.0f)); } } break; } }
void RegisterCheckpoint(Checkpoint.CheckpointType type, float timeAdd) { if (finishedRace || knockedOut) { return; } switch (type) { case Checkpoint.CheckpointType.Speedtrap: if (RaceManager.instance._raceType != RaceManager.RaceType.SpeedTrap) { return; } //add to the racers total speed float speed = 0; if (GetComponent <Car_Controller>()) { speed = GetComponent <Car_Controller>().currentSpeed; } if (GetComponent <Motorbike_Controller>()) { speed = GetComponent <Motorbike_Controller>().currentSpeed; } speedRecord += speed; //play a sound and show info if (gameObject.tag == "Player") { try { SoundManager.instance.PlayDefaultSound(SoundManager.instance.defaultSounds.speedTrapSound); } catch { } if (RaceManager.instance.showRaceInfoMessages) { RaceUI.instance.ShowRaceInfo("+ " + speed + " mph", 1.0f, Color.white); } } break; case Checkpoint.CheckpointType.TimeCheckpoint: //add our chekpoint checkpoint++; //add to the timer lapTimeCounter += timeAdd; //play a sound and show info if (gameObject.tag == "Player") { try { SoundManager.instance.PlayDefaultSound(SoundManager.instance.defaultSounds.checkpointSound); } catch { } if (RaceManager.instance.showRaceInfoMessages) { RaceUI.instance.ShowRaceInfo("+ " + RaceManager.instance.FormatTime(timeAdd), 1.0f, Color.white); } } break; } }