menu
This commit is contained in:
1 parent
6eb7bac08a
commit
6704c3ae59
46 files changed
+5298
-74
No files matched your search
@@ -15,15 +15,15 @@ public enum SectorColour {
|
||||
public readonly struct SectorTime {
|
||||
public SectorTime(int i, double t) {
|
||||
Sector = i;
|
||||
Value = t;
|
||||
Seconds = t;
|
||||
Colour = SectorColour.White;
|
||||
}
|
||||
|
||||
public int Sector { get; }
|
||||
public double Value { get; }
|
||||
public double Seconds { get; }
|
||||
public SectorColour Colour { get; }
|
||||
|
||||
public override string ToString() => $"{Value:0.000}";
|
||||
public override string ToString() => $"{Seconds:0.000}";
|
||||
|
||||
// public string ColourClass() => Colour switch {
|
||||
// SectorColour.Green => "green",
|
||||
@@ -38,12 +38,13 @@ public struct Lap {
|
||||
public int Number { get; set; }
|
||||
public List<SectorTime> Sectors { get; set; }
|
||||
|
||||
// 0:1:39
|
||||
public override string ToString() {
|
||||
return $"Lap {Number} : {TimeSpan.FromSeconds(TotalTime()):g} {String.Join(" ", Sectors.ConvertAll(s => s.ToString()))}";
|
||||
return $"{TimeSpan.FromSeconds(TotalTime()):m\\:ss\\.fff}";
|
||||
}
|
||||
|
||||
public double TotalTime() {
|
||||
return Sectors.Sum(s => s.Value);
|
||||
return Sectors.Sum(s => s.Seconds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ public class Timing: MonoBehaviour {
|
||||
var fastestLap = lapTimes.MinBy(l => l.TotalTime());
|
||||
var fastestSector = fastestLap.Sectors.Single(fls => fls.Sector == s.Sector);
|
||||
|
||||
return (s.Value < fastestSector.Value) switch {
|
||||
return (s.Seconds < fastestSector.Seconds) switch {
|
||||
true => SectorColour.Green,
|
||||
false => SectorColour.Yellow,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user