Fixed bug of deleting tanks

This commit is contained in:
Nikita Iryupin 2021-06-05 14:18:53 +02:00
parent 30164c64df
commit 93ea3efdac
2 changed files with 3 additions and 3 deletions

View File

@ -43,7 +43,7 @@ export class CollisionManager {
}
deleteFromAITank(tank) {
this._aiTanks = this._aiTanks.filter(t => tank.x != t.x && tank.y != t.y);
this._aiTanks = this._aiTanks.filter(t => tank.x != t.x || tank.y != t.y);
}
checkCollisionForTank(xMin, xMax, yMin, yMax, tank) {

View File

@ -47,7 +47,7 @@ export class AITankManager {
}
destroy(tank) {
this._activeTanks = this._activeTanks.filter(t => tank.x != t.x && tank.y != t.y);
this._activeTanks = this._activeTanks.filter(t => tank.x != t.x || tank.y != t.y);
this._collision.deleteFromAITank(tank);
this._canSpawn = true;
}
@ -62,7 +62,7 @@ export class AITankManager {
}
isAllTanksDied() {
return this._count == 0;
return this._count == 0 && this._activeTanks.length == 0;
}
getCount() {