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

@@ -22,16 +22,17 @@ public abstract class DrawPart{
/** Parameters for drawing a part in draw(). */
public static class PartParams{
//TODO document
public float warmup, reload, smoothReload, heat, recoil, life;
public float warmup, reload, smoothReload, heat, recoil, life, charge;
public float x, y, rotation;
public int sideOverride = -1, sideMultiplier = 1;
public PartParams set(float warmup, float reload, float smoothReload, float heat, float recoil, float x, float y, float rotation){
public PartParams set(float warmup, float reload, float smoothReload, float heat, float recoil, float charge, float x, float y, float rotation){
this.warmup = warmup;
this.reload = reload;
this.heat = heat;
this.recoil = recoil;
this.smoothReload = smoothReload;
this.charge = charge;
this.x = x;
this.y = y;
this.rotation = rotation;
@@ -65,6 +66,8 @@ public abstract class DrawPart{
smoothReload = p -> p.smoothReload,
/** Weapon warmup, 0 when not firing, 1 when actively shooting. Not equivalent to heat. */
warmup = p -> p.warmup,
/** Weapon charge, 0 when beginning to charge, 1 when finished */
charge = p -> p.charge,
/** Weapon recoil with no curve applied. */
recoil = p -> p.recoil,
/** Weapon heat, 1 when just fired, 0, when it has cooled down (duration depends on weapon) */

View File

@@ -127,7 +127,7 @@ public class RegionPart extends DrawPart{
float sign = (i == 1 ? -1 : 1) * params.sideMultiplier;
Tmp.v1.set((x + mx) * sign, y + my).rotate(params.rotation - 90);
childParam.set(params.warmup, params.reload, params.smoothReload, params.heat, params.recoil, params.x + Tmp.v1.x, params.y + Tmp.v1.y, i * sign + mr * sign + params.rotation);
childParam.set(params.warmup, params.reload, params.smoothReload, params.heat, params.recoil, params.charge, params.x + Tmp.v1.x, params.y + Tmp.v1.y, i * sign + mr * sign + params.rotation);
childParam.sideMultiplier = params.sideMultiplier;
childParam.life = params.life;
childParam.sideOverride = i;
@@ -174,4 +174,4 @@ public class RegionPart extends DrawPart{
child.getOutlines(out);
}
}
}
}

View File

@@ -20,6 +20,10 @@ public class WeaponMount{
public float heat;
/** lerps to 1 when shooting, 0 when not */
public float warmup;
/** is the weapon actively charging */
public boolean charging;
/** counts up to 1 when charging, 0 when not */
public float charge;
/** lerps to reload time */
public float smoothReload;
/** aiming position in world coordinates */