fix enemy speed
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import { Hex } from "../../util/Hex";
|
import { Hex } from '../../util/Hex';
|
||||||
import { Vector2 } from "../../util/Vector2";
|
import { Vector2 } from '../../util/Vector2';
|
||||||
import { SimEnemy } from "../SimEnemy";
|
import { SimEnemy } from '../SimEnemy';
|
||||||
import { SimMain } from "../SimMain";
|
import { SimMain } from '../SimMain';
|
||||||
import { ISimAction } from "./ISimAction";
|
import { ISimAction } from './ISimAction';
|
||||||
|
|
||||||
export class SimActionMoveEnemies implements ISimAction {
|
export class SimActionMoveEnemies implements ISimAction {
|
||||||
public execute(simMain: SimMain) {
|
public execute(simMain: SimMain) {
|
||||||
@@ -11,8 +11,7 @@ export class SimActionMoveEnemies implements ISimAction {
|
|||||||
|
|
||||||
const deadEnemies: number[] = [];
|
const deadEnemies: number[] = [];
|
||||||
level.enemies.forEach((enemy: SimEnemy, idx: number) => {
|
level.enemies.forEach((enemy: SimEnemy, idx: number) => {
|
||||||
if (enemy.dead)
|
if (enemy.dead) deadEnemies.push(idx);
|
||||||
deadEnemies.push(idx);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const idx of deadEnemies) {
|
for (const idx of deadEnemies) {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export class SimActionSpawnEnemies implements ISimAction {
|
|||||||
const path = PathFinding.bfs(level, startIndex, endIndex);
|
const path = PathFinding.bfs(level, startIndex, endIndex);
|
||||||
simEnemy.path = path!;
|
simEnemy.path = path!;
|
||||||
simEnemy.currentPathIndex = 0;
|
simEnemy.currentPathIndex = 0;
|
||||||
|
simEnemy.speed = simMain.gdRoot.enemies[gdWave.enemy].speed;
|
||||||
simEnemy.onPathUpdated(level);
|
simEnemy.onPathUpdated(level);
|
||||||
level.enemies.push(simEnemy);
|
level.enemies.push(simEnemy);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user