BulletType despawnUnit field (#7088)

* a

* i guess so

* despawnUnitCount, which i forgot to include
This commit is contained in:
smol
2022-06-29 11:27:51 +08:00
committed by GitHub
parent 4e3f7eccae
commit 366f4f490c

View File

@@ -184,6 +184,10 @@ public class BulletType extends Content implements Cloneable{
public Seq<BulletType> spawnBullets = new Seq<>();
/** Unit spawned _instead of_ this bullet. Useful for missiles. */
public @Nullable UnitType spawnUnit;
/** Unit spawned when this bullet hits something or despawns due to it hitting the end of its lifetime. */
public @Nullable UnitType despawnUnit;
/** Amount of units spawned when this bullet despawns. */
public int despawnUnitCount = 1;
/** Color of trail behind bullet. */
public Color trailColor = Pal.missileYellowBack;
@@ -443,6 +447,12 @@ public class BulletType extends Content implements Cloneable{
createFrags(b, b.x, b.y);
}
if(despawnUnit != null){
for(int i = 0; i < despawnUnitCount; i++){
despawnUnit.spawn(b.team, b.x + Mathf.range(0.1f), b.y);
}
}
despawnEffect.at(b.x, b.y, b.rotation(), hitColor);
despawnSound.at(b);