Fixed bug of deleting tanks
This commit is contained in:
parent
30164c64df
commit
93ea3efdac
@ -43,7 +43,7 @@ export class CollisionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteFromAITank(tank) {
|
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) {
|
checkCollisionForTank(xMin, xMax, yMin, yMax, tank) {
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export class AITankManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy(tank) {
|
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._collision.deleteFromAITank(tank);
|
||||||
this._canSpawn = true;
|
this._canSpawn = true;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ export class AITankManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isAllTanksDied() {
|
isAllTanksDied() {
|
||||||
return this._count == 0;
|
return this._count == 0 && this._activeTanks.length == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
getCount() {
|
getCount() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user