Auto-despawn core units

This commit is contained in:
Anuken
2020-05-22 09:37:19 -04:00
parent 88608b3f88
commit 46d15e0aab
3 changed files with 23 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
private transient UnitController controller;
private UnitType type;
boolean spawnedByCore;
public void moveAt(Vec2 vector){
moveAt(vector, type.accel);
@@ -171,6 +172,12 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
}
controller.update();
//remove units spawned by the core
if(spawnedByCore && !(controller instanceof Playerc)){
Fx.unitDespawn.at(x, y, 0, this);
remove();
}
}
@Override