Fixed bug of deleting tanks
This commit is contained in:
parent
30164c64df
commit
93ea3efdac
@ -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) {
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user