middle align diff sectors whatever

This commit is contained in:
ntr committed 2023-08-04 12:28:23 +10:00
1 parent 6f0ef954d8
commit beeac0ee8d
5 files changed
+119 -51

No files matched your search

+9 -5
View File
@@ -83,14 +83,16 @@ public class Timing: MonoBehaviour {
if (sector != sectorTimes.Count + 1)
return;
// alright they legitimately finished a sector...
double sTime = Time.timeAsDouble - sectorStart;
SectorTime s = new SectorTime { Sector = sector, Seconds = sTime };
sectorTimes.Add(s);
sectorStart = Time.timeAsDouble;
Debug.Log($"{sectorTimes.Count} / {sectors.Length}");
// restart the timer for the next sector
sectorStart = Time.timeAsDouble;
// they finished a lap!
if (sectorTimes.Count == sectors.Length) {
EndLap();
NextLap();
@@ -111,13 +113,15 @@ public class Timing: MonoBehaviour {
Lap l = new Lap { Map = mapName, Sectors = sectorTimes };
Debug.Log($"EndLap {l}");
LapStorageService.PersistLap(l);
// have to show this before we persist the lap in case it is the pb
StartCoroutine(RecentLapLifecycle(l));
LapStorageService.PersistLap(l);
}
IEnumerator RecentLapLifecycle(Lap l) {
ui.ShowRecentLap(l);
yield return new WaitForSeconds(3);
yield return new WaitForSeconds(5);
ui.HideRecentLap();
}