private void OnTriggerEnter(Collider other) { if (other.name == "Player") { playerController.lastCheckpoint = transform; OnCheckpointReached?.Invoke(this); if (singleUse) { gameObject.SetActive(false); } } }
private void CheckpointReached() { if (currentCheckpoint == 0) { if (lapTime < bestLapTime) { bestLapTime = lapTime; } lapTime = 0.0f; } currentCheckpoint++; if (currentCheckpoint >= checkpoints.Count) { currentCheckpoint = 0; } checkpointReached?.Invoke(); }