Weapon charge sound

This commit is contained in:
Anuken 2020-10-04 09:42:49 -04:00
parent 55feb38cb7
commit c4fb84c359
3 changed files with 30 additions and 3 deletions

View File

@ -166,14 +166,15 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
Weapon weapon = mount.weapon;
float baseX = this.x, baseY = this.y;
boolean delay = weapon.firstShotDelay > 0f;
weapon.shootSound.at(x, y, Mathf.random(0.8f, 1.0f));
(delay ? weapon.chargeSound : weapon.shootSound).at(x, y, Mathf.random(0.8f, 1.0f));
BulletType ammo = weapon.bullet;
float lifeScl = ammo.scaleVelocity ? Mathf.clamp(Mathf.dst(x, y, aimX, aimY) / ammo.range()) : 1f;
sequenceNum = 0;
if(weapon.shotDelay + weapon.firstShotDelay > 0.01f){
if(delay){
Angles.shotgun(weapon.shots, weapon.spacing, rotation, f -> {
Time.run(sequenceNum * weapon.shotDelay + weapon.firstShotDelay, () -> {
if(!isAdded()) return;
@ -187,13 +188,14 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc, Velc, Statusc{
boolean parentize = ammo.keepVelocity;
if(weapon.firstShotDelay > 0){
if(delay){
Time.run(weapon.firstShotDelay, () -> {
if(!isAdded()) return;
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));
Effect.shake(weapon.shake, weapon.shake, x, y);
mount.heat = 1f;
weapon.shootSound.at(x, y, Mathf.random(0.8f, 1.0f));
});
}else{
vel.add(Tmp.v1.trns(rotation + 180f, ammo.recoil));

View File

@ -266,7 +266,30 @@ public class DefaultWaves{
}
}
int bossWave = Mathf.random(30, 60);
int bossSpacing = Mathf.random(30, 50);
//main boss progression
out.add(new SpawnGroup(Structs.random(species)[4]){{
unitAmount = 1;
begin = bossWave;
spacing = bossSpacing;
end = never;
max = 16;
unitScaling = bossSpacing;
shieldScaling = shieldsPerWave;
}});
//alt boss progression
out.add(new SpawnGroup(Structs.random(species)[4]){{
unitAmount = 1;
begin = bossWave + Mathf.random(4, 6) * bossSpacing;
spacing = bossSpacing;
end = never;
max = 16;
unitScaling = bossSpacing;
shieldScaling = shieldsPerWave;
}});
return out;
}

View File

@ -70,6 +70,8 @@ public class Weapon{
public int otherSide = -1;
/** sound used for shooting */
public Sound shootSound = Sounds.pew;
/** sound used for weapons that have a delay */
public Sound chargeSound = Sounds.none;
/** sound played when there is nothing to shoot */
public Sound noAmmoSound = Sounds.click;
/** displayed region (autoloaded) */