3D spaceshooter with online scoreboard, online demos, ship building. Now entirely defunct, but might be resurrected
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sector/src/net/sector/level/sequence/EnemyWave.java

52 lines
922 B

package net.sector.level.sequence;
import java.util.HashSet;
import com.porcupine.math.Calc;
import net.sector.entities.Entity;
/**
* Wave of entities
*
* @author Ondřej Hruška (MightyPork)
*/
public class EnemyWave extends HashSet<Entity> {
/**
* Check if all entities in this wave are dead.
*
* @return all are dead
*/
public boolean isDead() {
for (Entity e : this) {
if (!e.isDead()) return false;
}
clear();
return true;
}
/**
* Kill all entities in wave (add damage and set dead)
*/
public void killAll() {
for (Entity e : this) {
e.addDamage(null, 100000);
e.setDead();
}
}
@Override
public String toString() {
String s = "";
s += "\n+---\n";
s += " Enemy Wave, size = "+size()+"\n";
for(Entity e: this) {
System.out.println(" -- name:"+Calc.className(e)+", hp:"+e.getHealth()+", dead:"+e.isDead()+", pos: "+e.getPos());
}
return s;
}
}