sector colour wip
This commit is contained in:
1 parent
3ad4b5ca2e
commit
64727058df
2 files changed
+12
No files matched your search
@@ -47,6 +47,7 @@ public class ShipUi : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sectors.Clear();
|
sectors.Clear();
|
||||||
|
|
||||||
foreach (Sector sector in timing.sectors) {
|
foreach (Sector sector in timing.sectors) {
|
||||||
Label l = timing.sectorTimes
|
Label l = timing.sectorTimes
|
||||||
.Where(s => s.Sector == sector.sector)
|
.Where(s => s.Sector == sector.sector)
|
||||||
|
|||||||
@@ -146,5 +146,16 @@ public class Timing: MonoBehaviour {
|
|||||||
lapTimes.Add(l);
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user