diff --git a/assets/Data/GameSettings.json b/assets/Data/GameSettings.json index 915aa44..fd1b2ab 100644 --- a/assets/Data/GameSettings.json +++ b/assets/Data/GameSettings.json @@ -64,6 +64,7 @@ "cooldown": 5, "enemiesPerWave": 30, "waveLifetime": 20, + "enemyMoveType": "Launch", "enemyType": "Basic" } } diff --git a/assets/Scripts/Game/Data/GameSettings.ts b/assets/Scripts/Game/Data/GameSettings.ts index b2bbb5d..948bc32 100644 --- a/assets/Scripts/Game/Data/GameSettings.ts +++ b/assets/Scripts/Game/Data/GameSettings.ts @@ -56,6 +56,6 @@ export class WaveEnemySpawnerSettings { public cooldown = 0; public enemiesPerWave = 0; public waveLifetime = 0; - public moveType = ""; + public enemyMoveType = ""; public enemyType = ""; } diff --git a/assets/Scripts/Game/Unit/Enemy/EnemySpawner/WaveEnemySpawner.ts b/assets/Scripts/Game/Unit/Enemy/EnemySpawner/WaveEnemySpawner.ts index b74bd4a..01e1e52 100644 --- a/assets/Scripts/Game/Unit/Enemy/EnemySpawner/WaveEnemySpawner.ts +++ b/assets/Scripts/Game/Unit/Enemy/EnemySpawner/WaveEnemySpawner.ts @@ -20,7 +20,7 @@ export class WaveEnemySpawner { this.spawnTimer = new GameTimer(settings.cooldown); this.enemiesPerWave = settings.enemiesPerWave; this.waveLifetime = settings.waveLifetime; - this.moveType = settings.moveType; + this.moveType = settings.enemyMoveType; this.enemyType = settings.enemyType; } @@ -60,7 +60,7 @@ export class WaveEnemySpawner { const randomOffsetY: number = randomRange(-20, 20); const posX: number = defaultPosX + randomOffsetX + 50 * (i % side); const posY: number = defaultPosY + randomOffsetY + 50 * Math.floor(i / side); - const enemy = this.enemySpawner.spawnNewEnemy(posX, posY, EnemyMovementType.Launch); + const enemy = this.enemySpawner.spawnNewEnemy(posX, posY, this.moveType); enemies.push(enemy); } diff --git a/utils/regenerateGameSettings.ts b/utils/regenerateGameSettings.ts index dcc6957..4f37faf 100644 --- a/utils/regenerateGameSettings.ts +++ b/utils/regenerateGameSettings.ts @@ -31,6 +31,8 @@ function deleteUnusedProperties(templateSettings: GameSettings, savedSettings: G } function getAllKeys(objectWithKeys: any, prefix = ""): string[] { + if (typeof objectWithKeys === "string") return []; + const keys: string[] = []; const objectKeys: string[] = Object.keys(objectWithKeys);