use of io.anuke.mindustry.game.EnemySpawn in project Mindustry by Anuken.
the class Logic method runWave.
public void runWave() {
if (state.lastUpdated < state.wave + 1) {
world.pathfinder().resetPaths();
state.lastUpdated = state.wave + 1;
}
for (EnemySpawn spawn : spawns) {
Array<SpawnPoint> spawns = world.getSpawns();
for (int lane = 0; lane < spawns.size; lane++) {
int fl = lane;
Tile tile = spawns.get(lane).start;
int spawnamount = spawn.evaluate(state.wave, lane);
for (int i = 0; i < spawnamount; i++) {
float range = 12f;
Timers.runTask(i * 5f, () -> {
Enemy enemy = new Enemy(spawn.type);
enemy.set(tile.worldx() + Mathf.range(range), tile.worldy() + Mathf.range(range));
enemy.lane = fl;
enemy.tier = spawn.tier(state.wave, fl);
enemy.add();
Effects.effect(Fx.spawn, enemy);
state.enemies++;
});
}
}
}
state.wave++;
state.wavetime = wavespace * state.difficulty.timeScaling;
state.extrawavetime = maxwavespace * state.difficulty.maxTimeScaling;
Events.fire(WaveEvent.class);
}
Aggregations