diff --git a/Assets/Src/ShipUi.cs b/Assets/Src/ShipUi.cs index 4d75bff..223293d 100644 --- a/Assets/Src/ShipUi.cs +++ b/Assets/Src/ShipUi.cs @@ -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) diff --git a/Assets/Src/Timing.cs b/Assets/Src/Timing.cs index 680d19e..f9257b0 100644 --- a/Assets/Src/Timing.cs +++ b/Assets/Src/Timing.cs @@ -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, + }; + } }