diff --git a/Assets/Src/PowerUnit.cs b/Assets/Src/PowerUnit.cs
index 5d541f2..4423ee7 100644
--- a/Assets/Src/PowerUnit.cs
+++ b/Assets/Src/PowerUnit.cs
@@ -37,30 +37,30 @@ public class PowerUnit {
public float Shield => shieldCurrent;
public float ShieldMax => shieldMax;
public string ShieldPct => $"{((shieldCurrent / shieldMax) * 100f):0}";
- float ShieldRegen => boostActive.Count switch {
+ float ShieldRegen => BoostActive.Count switch {
0 => (shieldMax / 5f) * Time.fixedDeltaTime,
_ => 0f,
};
// Boost
- List<(Output output, double expiresAt)> boostActive = new();
static double boostFullChargeSeconds = 10f;
- static double boostDurationSeconds = 2f;
+ public static double boostDurationSeconds = 2f;
double boostMax = 2f * boostDurationSeconds;
double boostProgress = 0f;
double boostAvailable = 0f;
+ public List<(Output output, double expiresAt)> BoostActive = new();
public double BoostProgress => boostProgress / boostMax;
public int BoostCharges => (int)(boostMax / boostDurationSeconds);
public float Acceleration =>
- acceleration + boostActive.Count(b => b.output == Output.Acceleration) * baseOutput;
+ acceleration + BoostActive.Count(b => b.output == Output.Acceleration) * baseOutput;
public float Deceleration =>
- deceleration + boostActive.Count(b => b.output == Output.Deceleration) * baseOutput;
+ deceleration + BoostActive.Count(b => b.output == Output.Deceleration) * baseOutput;
public float Strafing =>
- strafing + boostActive.Count(b => b.output == Output.Strafing) * baseOutput;
+ strafing + BoostActive.Count(b => b.output == Output.Strafing) * baseOutput;
double BoostRegen => (boostMax / boostFullChargeSeconds) * Time.fixedDeltaTime;
@@ -69,7 +69,7 @@ public class PowerUnit {
deceleration = initialDeceleration;
strafing = initialStrafing;
- boostActive = new();
+ BoostActive = new();
boostProgress = 0f;
shieldMax = initialShieldMax;
@@ -78,17 +78,17 @@ public class PowerUnit {
public void Deploy(Output output) {
if (boostAvailable < boostDurationSeconds) return;
- boostActive.Add((output, Time.timeAsDouble + boostDurationSeconds));
+ BoostActive.Add((output, Time.timeAsDouble + boostDurationSeconds));
boostAvailable -= boostDurationSeconds;
}
public void Tick() {
- if (boostProgress <= 0f) boostActive.Clear();
+ if (boostProgress <= 0f) BoostActive.Clear();
// remove expired boosts
- boostActive = boostActive.Where(b => b.expiresAt > Time.timeAsDouble).ToList();
+ BoostActive = BoostActive.Where(b => b.expiresAt > Time.timeAsDouble).ToList();
- double delta = boostActive.Count switch {
+ double delta = BoostActive.Count switch {
// if there are no boosts active we can increase the store
0 => BoostRegen,
// if there are active boosts we deplete it
@@ -104,7 +104,7 @@ public class PowerUnit {
boostProgress = Math.Max(0f, next);
if (delta > 0f) boostAvailable = boostProgress;
- shieldMax = initialShieldMax + boostActive.Count(b => b.output == Output.Shield) * 1000f;
+ shieldMax = initialShieldMax + BoostActive.Count(b => b.output == Output.Shield) * 1000f;
shieldCurrent = Math.Min(shieldCurrent + ShieldRegen, shieldMax);
}
diff --git a/Assets/Src/UI/Controls.uxml b/Assets/Src/UI/Controls.uxml
index e49b821..b88acca 100644
--- a/Assets/Src/UI/Controls.uxml
+++ b/Assets/Src/UI/Controls.uxml
@@ -7,9 +7,8 @@
-
-
-
+
+
@@ -30,9 +29,6 @@
-
-
-
diff --git a/Assets/Src/UI/ControlsUI.cs b/Assets/Src/UI/ControlsUI.cs
index 47f7505..2c20050 100644
--- a/Assets/Src/UI/ControlsUI.cs
+++ b/Assets/Src/UI/ControlsUI.cs
@@ -18,18 +18,72 @@ public class ControlsUI : MonoBehaviour {
BoostBar boostBar;
InterfaceIcon shield;
+ VisualElement accelCtr;
+ VisualElement decelCtr;
+ VisualElement strafeCtr;
+ VisualElement shieldCtr;
+
+ BoostIndicator[] accelBoosts;
+ BoostIndicator[] decelBoosts;
+ BoostIndicator[] strafeBoosts;
+ BoostIndicator[] shieldBoosts;
+
+ void Awake() {
+ Init();
+ }
+
void OnEnable() {
Init();
}
void Init() {
+ accelBoosts = new BoostIndicator[ship.powerUnit.BoostCharges];
+ decelBoosts = new BoostIndicator[ship.powerUnit.BoostCharges];
+ strafeBoosts = new BoostIndicator[ship.powerUnit.BoostCharges];
+ shieldBoosts = new BoostIndicator[ship.powerUnit.BoostCharges];
+
uiDocument = GetComponent();
speed = uiDocument.rootVisualElement.Q