we poppin

This commit is contained in:
ntr committed 2023-09-27 01:34:36 +10:00
1 parent 336945533b
commit 9f6e615653
88 files changed
+979 -170

No files matched your search

+4 -7
View File
@@ -54,6 +54,7 @@ public class PowerUnit {
public List<(Output output, double expiresAt)> BoostActive = new();
public double BoostProgress => boostProgress / boostMax;
public int BoostCharges => (int)(boostMax / boostDurationSeconds);
public int BoostChargesAvailable => (int)(boostAvailable / boostDurationSeconds);
public float Acceleration =>
acceleration + BoostActive.Count(b => b.output == Output.Acceleration) * baseOutput;
@@ -78,12 +79,13 @@ public class PowerUnit {
shieldCurrent = initialShieldMax;
}
public void Deploy(Output output) {
if (boostAvailable < boostDurationSeconds) return;
public bool Deploy(Output output) {
if (boostAvailable < boostDurationSeconds) return false;
BoostActive.Add((output, Time.timeAsDouble + boostDurationSeconds));
boostAvailable -= boostDurationSeconds;
if (output == Output.Shield) ShieldsBoost();
return true;
}
public void Tick() {
@@ -99,11 +101,6 @@ public class PowerUnit {
int count => count * Time.fixedDeltaTime * -1f,
};
// boost available gets dragged up by the clock
// when the delta is positive
// which can only happen when there are no active boosts
// check it vvvv
// Debug.Log($"Progress={boostProgress} actualAvailability={boostAvailable}");
double next = Math.Min(boostProgress + delta, boostMax);
boostProgress = Math.Max(0f, next);
if (delta > 0f) boostAvailable = boostProgress;