junglish
This commit is contained in:
1 parent
60f88367bc
commit
bbcb434cd0
11 files changed
+62936
-115
No files matched your search
+22
-10
@@ -5,26 +5,38 @@ using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
public enum SectorColour {
|
||||
Green,
|
||||
Purple,
|
||||
White,
|
||||
Yellow,
|
||||
}
|
||||
|
||||
public readonly struct SectorTime {
|
||||
public SectorTime(int i, double t) {
|
||||
Sector = i;
|
||||
Value = t;
|
||||
Colour = SectorColour.White;
|
||||
}
|
||||
|
||||
public int Sector { get; }
|
||||
public double Value { get; }
|
||||
public SectorColour Colour { get; }
|
||||
|
||||
public override string ToString() => $"{Sector} {Value:0.000}";
|
||||
|
||||
public string ColourClass() => Colour switch {
|
||||
SectorColour.Green => "green",
|
||||
SectorColour.Purple => "purple",
|
||||
SectorColour.White => "white",
|
||||
SectorColour.Yellow => "yellow",
|
||||
_ => throw new Exception("unknown colour"),
|
||||
};
|
||||
}
|
||||
|
||||
public readonly struct Lap {
|
||||
public Lap(int i, List<SectorTime> s) {
|
||||
Sectors = s;
|
||||
Number = i;
|
||||
}
|
||||
|
||||
public int Number { get; }
|
||||
public List<SectorTime> Sectors { get; }
|
||||
public struct Lap {
|
||||
public int Number { get; set; }
|
||||
public List<SectorTime> Sectors { get; set; }
|
||||
|
||||
public override string ToString() {
|
||||
return $"Lap {Number} : {TimeSpan.FromSeconds(TotalTime()):g} {String.Join(" ", Sectors.ConvertAll(s => s.ToString()))}";
|
||||
@@ -47,7 +59,7 @@ public class Timing: MonoBehaviour {
|
||||
Sector[] sectors;
|
||||
|
||||
void Awake() {
|
||||
lapTimes = new List<Lap>();
|
||||
lapTimes = new();
|
||||
sectorTimes = new List<SectorTime>();
|
||||
sectorStart = 0.0;
|
||||
sectorTime = 0.0;
|
||||
@@ -121,7 +133,7 @@ public class Timing: MonoBehaviour {
|
||||
Awake();
|
||||
|
||||
if (sectorTimes.Count > 0) {
|
||||
Lap l = new Lap(lapTimes.Count, sectorTimes);
|
||||
Lap l = new Lap { Number = lapTimes.Count, Sectors = sectorTimes };
|
||||
Debug.Log($"EndLap {l}");
|
||||
lapTimes.Add(l);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user