void AddFinishedLapTime(int lap) { TimeDisplayItem newItem = GetItem(lap); newItem.SetText(getTimeString(finishedLapTimes[lap])); newItem.SetTitle($"Lap {lap+1}:"); newItem.gameObject.SetActive(true); }
void SetLaps(int laps) { for (int i = 0; i < laps; i++) { TimeDisplayItem newItem = timeDisplayItem.getObject(false, finishedLapsParent.transform).GetComponent <TimeDisplayItem>(); finishedLapsParent.UpdateTable(newItem.gameObject); lapTimesText.Add(newItem); } }
TimeDisplayItem GetItem(int i) { if (i >= lapTimesText.Count) { TimeDisplayItem newItem = timeDisplayItem.getObject(false, finishedLapsParent.transform).GetComponent <TimeDisplayItem>(); finishedLapsParent.UpdateTable(newItem.gameObject); lapTimesText.Add(newItem); return(newItem); } return(lapTimesText[i]); }
void AddFinishedLapTime(int lap) { TimeDisplayItem newItem = GetItem(lap); //Se comprueba si se ha superado el record para mostrarlo por pantalla if (bestCurrentTime > finishedLapTimes[lap] || bestCurrentTime < 0) { //Se actualiza el bestCurrentTime bestCurrentTime = finishedLapTimes[lap]; //Muestra el nuevo record StartCoroutine(ShowNewRecordPopUp()); } newItem.SetText(getTimeString(finishedLapTimes[lap])); newItem.SetTitle($"Lap {lap+1}:"); newItem.gameObject.SetActive(true); }