diff --git a/Assets/Src/PowerUnit.cs b/Assets/Src/PowerUnit.cs index 4423ee7..6fa1dbf 100644 --- a/Assets/Src/PowerUnit.cs +++ b/Assets/Src/PowerUnit.cs @@ -32,14 +32,16 @@ public class PowerUnit { static float initialShieldMax = 5000f; float shieldCurrent = initialShieldMax; float shieldMax = initialShieldMax; - float shieldRegen = 10f; // * 100 ticks per second = 5s fully recharge + static float shieldBoostIncrease = 1000f; + static float shieldBoostAmount = 1000f; public float Shield => shieldCurrent; - public float ShieldMax => shieldMax; public string ShieldPct => $"{((shieldCurrent / shieldMax) * 100f):0}"; - float ShieldRegen => BoostActive.Count switch { - 0 => (shieldMax / 5f) * Time.fixedDeltaTime, - _ => 0f, + + bool UsingMovementBoost => BoostActive.Any(b => b.output != Output.Shield); + float ShieldRegen => UsingMovementBoost switch { + false => (shieldMax / 5f) * Time.fixedDeltaTime, + true => 0f, }; // Boost @@ -80,6 +82,8 @@ public class PowerUnit { if (boostAvailable < boostDurationSeconds) return; BoostActive.Add((output, Time.timeAsDouble + boostDurationSeconds)); boostAvailable -= boostDurationSeconds; + + if (output == Output.Shield) ShieldsBoost(); } public void Tick() { @@ -104,7 +108,7 @@ public class PowerUnit { boostProgress = Math.Max(0f, next); if (delta > 0f) boostAvailable = boostProgress; - shieldMax = initialShieldMax + BoostActive.Count(b => b.output == Output.Shield) * 1000f; + ShieldsSetMax(); shieldCurrent = Math.Min(shieldCurrent + ShieldRegen, shieldMax); } @@ -113,4 +117,13 @@ public class PowerUnit { shieldCurrent = shieldCurrent - amt; return shieldCurrent < 0f; } + + void ShieldsBoost() { + ShieldsSetMax(); + shieldCurrent = Math.Min(shieldCurrent + shieldBoostIncrease, shieldMax); + } + + void ShieldsSetMax() { + shieldMax = initialShieldMax + BoostActive.Count(b => b.output == Output.Shield) * shieldBoostAmount; + } } \ No newline at end of file diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 77e4ef3..dcbe2de 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -134,7 +134,8 @@ PlayerSettings: vulkanEnableCommandBufferRecycling: 1 loadStoreDebugModeEnabled: 0 bundleVersion: 0.1 - preloadedAssets: [] + preloadedAssets: + - {fileID: 11400000, guid: 020903acd8b50dd45a683fb9312ba7af, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1 diff --git a/TODO.md b/TODO.md index 6d51c33..fc68363 100644 --- a/TODO.md +++ b/TODO.md @@ -1,13 +1,15 @@ # SpaceRace! -- controls diagram +- post times to server + - in theory yes + - rename completions to laps with migration -- shield regen bug +- controls diagram + - mouse / controller sens + - invert y - git lfs -- post times to server - - models - liquidator - cruise craft racing