enemy spawn and next wave start refactoring
This commit is contained in:
@@ -5,6 +5,7 @@ import { PathFinding } from '../util/PathFinding';
|
||||
import { ECellType } from './ECellType';
|
||||
import { SimCell } from './SimCell';
|
||||
import { SimEnemy } from './SimEnemy';
|
||||
import { SimMain } from './SimMain';
|
||||
import { SimProjectile } from './SimProjectile';
|
||||
|
||||
export class SimLevel {
|
||||
@@ -63,6 +64,19 @@ export class SimLevel {
|
||||
|
||||
this.updatePaths(gdRoot);
|
||||
}
|
||||
|
||||
public startNextWave(simMain: SimMain) {
|
||||
const data = simMain.gdRoot.levels[this.index];
|
||||
this.currentWave += 1;
|
||||
if (!data.waves[this.currentWave]) {
|
||||
this.paused = true;
|
||||
return;
|
||||
}
|
||||
this.nextWaveStep = this.currentStep + simMain.gdRoot.simulation.waveDuration * simMain.gdRoot.simulation.stepsPerSecond - 1;
|
||||
this.lastEnemySpawnStep = this.currentStep;
|
||||
this.enemiesLeftToSpawn = data.waves[this.currentWave].amount;
|
||||
this.paused = false;
|
||||
}
|
||||
|
||||
public getCellIndex(hex: Hex) {
|
||||
const x = hex.col + this.radius;
|
||||
|
||||
Reference in New Issue
Block a user