mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-12 03:37:27 +07:00
Weapon charge sound
This commit is contained in:
parent
55feb38cb7
commit
c4fb84c359
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) */
|
||||
|
Loading…
Reference in New Issue
Block a user