boost cooldowns
This commit is contained in:
1 parent
e10e034702
commit
ccd8e2c923
3 files changed
+91
-40
No files matched your search
+13
-12
@@ -24,7 +24,7 @@ public class PowerUnit {
|
||||
float shieldRegen = 10f; // * 100 ticks per second = 5s fully recharge
|
||||
|
||||
int boostMax = 2;
|
||||
int boostCharges = 2;
|
||||
int boostCharges = 0;
|
||||
|
||||
static float stablisation = 75f;
|
||||
|
||||
@@ -37,9 +37,10 @@ public class PowerUnit {
|
||||
|
||||
public string ShieldPct => $"{((shieldCurrent / shieldMax) * 100f):0}";
|
||||
public string BoostsAvailable => $"{boostCharges}";
|
||||
public bool BoostRecharging => boostCharges < boostMax;
|
||||
|
||||
public void Init() {
|
||||
boostCharges = boostMax;
|
||||
boostCharges = 0;
|
||||
shieldCurrent = initialShieldMax;
|
||||
acceleration = initialAcceleration;
|
||||
deceleration = initialDeceleration;
|
||||
@@ -48,20 +49,20 @@ public class PowerUnit {
|
||||
|
||||
// Regeneration of boosts is tracked by the ShipControls
|
||||
// it has to handle tracking the coroutines etc
|
||||
public void BoostRegenerate() {
|
||||
public void BoostGenerate() {
|
||||
boostCharges = Math.Min(boostCharges + 1, boostMax);
|
||||
Debug.Log($"Boosts available {boostCharges}");
|
||||
}
|
||||
|
||||
public bool BoostUse(Output output) {
|
||||
public bool BoostDeploy(Output output) {
|
||||
if (boostCharges < 1)
|
||||
return false;
|
||||
|
||||
float newOutput = output switch {
|
||||
Output.Acceleration => BoostUseAcceleration(),
|
||||
Output.Deceleration => BoostUseDeceleration(),
|
||||
Output.Strafing => BoostUseStrafing(),
|
||||
Output.Shield => BoostUseShields(),
|
||||
Output.Acceleration => BoostDeployAcceleration(),
|
||||
Output.Deceleration => BoostDeployDeceleration(),
|
||||
Output.Strafing => BoostDeployStrafing(),
|
||||
Output.Shield => BoostDeployShields(),
|
||||
_ => 0f,
|
||||
};
|
||||
|
||||
@@ -73,10 +74,10 @@ public class PowerUnit {
|
||||
return true;
|
||||
}
|
||||
|
||||
float BoostUseAcceleration() => acceleration += baseOutput;
|
||||
float BoostUseDeceleration() => deceleration += baseOutput;
|
||||
float BoostUseStrafing() => strafing += baseOutput;
|
||||
float BoostUseShields() {
|
||||
float BoostDeployAcceleration() => acceleration += baseOutput;
|
||||
float BoostDeployDeceleration() => deceleration += baseOutput;
|
||||
float BoostDeployStrafing() => strafing += baseOutput;
|
||||
float BoostDeployShields() {
|
||||
float shieldFrac = shieldMax / shieldCurrent;
|
||||
shieldMax = 7000f;
|
||||
shieldCurrent = shieldMax * shieldFrac;
|
||||
|
||||
Reference in new issue
Block a user