use of io.anuke.mindustry.game.SpawnPoint 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);
}
use of io.anuke.mindustry.game.SpawnPoint in project Mindustry by Anuken.
the class WorldGenerator method generate.
/**
*Returns the core (starting) block. Should fill spawns with the correct spawnpoints.
*/
public static Tile generate(Pixmap pixmap, Tile[][] tiles, Array<SpawnPoint> spawns) {
Noise.setSeed(world.getSeed());
Tile core = null;
for (int x = 0; x < pixmap.getWidth(); x++) {
for (int y = 0; y < pixmap.getHeight(); y++) {
Block floor = Blocks.stone;
Block block = Blocks.air;
int color = pixmap.getPixel(x, pixmap.getHeight() - 1 - y);
BlockPair pair = ColorMapper.get(color);
if (pair != null) {
block = pair.wall;
floor = pair.floor;
}
if (block == SpecialBlocks.playerSpawn) {
block = Blocks.air;
core = world.tile(x, y);
} else if (block == SpecialBlocks.enemySpawn) {
block = Blocks.air;
spawns.add(new SpawnPoint(tiles[x][y]));
}
if (block == Blocks.air && Mathf.chance(0.025) && rocks.containsKey(floor)) {
block = rocks.get(floor);
}
if (world.getMap().oreGen && (floor == Blocks.stone || floor == Blocks.grass || floor == Blocks.blackstone || floor == Blocks.snow || floor == Blocks.sand)) {
if (Noise.nnoise(x, y, 8, 1) > 0.21) {
floor = Blocks.iron;
}
if (Noise.nnoise(x, y, 6, 1) > 0.237) {
floor = Blocks.coal;
}
if (Noise.nnoise(x + 9999, y + 9999, 8, 1) > 0.27) {
floor = Blocks.titanium;
}
if (Noise.nnoise(x + 99999, y + 99999, 7, 1) > 0.259) {
floor = Blocks.uranium;
}
}
if (color == Hue.rgb(Color.PURPLE)) {
if (!Vars.android)
new Enemy(EnemyTypes.target).set(x * tilesize, y * tilesize).add();
floor = Blocks.stone;
}
tiles[x][y].setBlock(block, 0);
tiles[x][y].setFloor(floor);
}
}
for (int x = 0; x < pixmap.getWidth(); x++) {
for (int y = 0; y < pixmap.getHeight(); y++) {
tiles[x][y].updateOcclusion();
}
}
return core;
}
Aggregations