This commit is contained in:
ntr committed 2023-07-16 21:51:40 +10:00
1 parent 5d0abd46cd
commit d424edf9be
11 files changed
+62936 -115

No files matched your search

@@ -1,9 +1,9 @@
using UnityEngine;
public class TrackLimits : MonoBehaviour {
public class ShipPhysics : MonoBehaviour {
ShipControls ship;
float maxDmg = 5000f;
float maxDmg = 150f;
void Awake() {
ship = GetComponent<ShipControls>();
File renamed without changes.
+6 -1
View File
@@ -41,6 +41,11 @@ public class ShipUi : MonoBehaviour {
timeSheet.Add(l);
}
sectors.text = $"{String.Join(" ", timing.sectorTimes)}";
foreach (SectorTime sector in timing.sectorTimes) {
Label l = new Label();
l.text = $"{sector}";
l.AddToClassList(sector.ColourClass());
sectors.Add(l);
}
}
}
+22 -1
View File
@@ -1,5 +1,14 @@
:root {
--green: rgb(31, 240, 31);
--red: rgb(165, 42, 42);
--blue: rgb(48, 80, 248);
--purple: rgb(164, 35, 188);
--yellow: #ffa100;
--white: #f5f5f5;
}
#shipUi {
color: white;
color: var(--white);
font-size: 21px;
}
@@ -19,3 +28,15 @@
font-size: 18px;
color: rgb(49, 26, 17);
}
.green {
color: var(--green);
}
.purple {
color: var(--purple);
}
.red {
color: var(--red);
}
+22 -10
View File
@@ -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);
}