Charge Progress (#6947)

This commit is contained in:
MEEPofFaith
2022-06-08 06:13:11 -07:00
committed by GitHub
parent 4a6600b94d
commit 968651d9ed
7 changed files with 24 additions and 15 deletions

View File

@@ -200,7 +200,7 @@ public class Turret extends ReloadTurret{
public Seq<AmmoEntry> ammo = new Seq<>();
public int totalAmmo;
public float curRecoil, heat, logicControlTime = -1;
public float shootWarmup;
public float shootWarmup, charge;
public int totalShots;
//turrets need to shoot once for 'visual reload' to be valid, otherwise they seem stuck at reload 0 when placed.
public boolean visualReloadValid;
@@ -348,8 +348,9 @@ public class Turret extends ReloadTurret{
wasShooting = false;
curRecoil = Math.max(curRecoil - Time.delta / recoilTime , 0);
heat = Math.max(heat - Time.delta / cooldownTime, 0);
curRecoil = Mathf.approachDelta(curRecoil, 0, 1 / recoilTime);
heat = Mathf.approachDelta(heat, 0, 1 / cooldownTime);
charge = charging() ? Mathf.approachDelta(charge, 1, 1 / shoot.firstShotDelay) : 0;
unit.tile(this);
unit.rotation(rotation);

View File

@@ -70,7 +70,7 @@ public class DrawTurret extends DrawBlock{
float progress = tb.visualReloadValid ? tb.progress() : 1f;
//TODO no smooth reload
var params = DrawPart.params.set(build.warmup(), 1f - progress, 1f - progress, tb.heat, tb.curRecoil, tb.x + tb.recoilOffset.x, tb.y + tb.recoilOffset.y, tb.rotation);
var params = DrawPart.params.set(build.warmup(), 1f - progress, 1f - progress, tb.heat, tb.curRecoil, tb.charge, tb.x + tb.recoilOffset.x, tb.y + tb.recoilOffset.y, tb.rotation);
for(var part : parts){
part.draw(params);