sector colour wip

This commit is contained in:
ntr committed 2023-07-19 17:59:33 +10:00
1 parent dfb839b48d
commit 926415e786
2 files changed
+12

No files matched your search

+1
View File
@@ -47,6 +47,7 @@ public class ShipUi : MonoBehaviour {
}
sectors.Clear();
foreach (Sector sector in timing.sectors) {
Label l = timing.sectorTimes
.Where(s => s.Sector == sector.sector)
+11
View File
@@ -146,5 +146,16 @@ public class Timing: MonoBehaviour {
lapTimes.Add(l);
}
}
public SectorColour GetSectorColour(SectorTime s) {
var fastestLap = lapTimes.MinBy(l => l.TotalTime());
var fastestSector = fastestLap.Single(fls => fls.Sector == s.Sector);
return s.Value switch {
< fastestSector.Value => SectorColour.Green,
> fastestSector.Value => SectorColour.Yellow,
_ => SectorColour.White,
};
}
}