fix: 移除跟随者

This commit is contained in:
unanmed 2025-11-27 19:46:32 +08:00
parent 9a7fb25533
commit 4f02d166f2
2 changed files with 7 additions and 1 deletions

View File

@ -389,6 +389,7 @@ export class MapHeroRenderer implements IMapHeroRenderer {
return;
}
if (index === this.entities.length - 1) {
this.entities[index].block.destroy();
this.entities.splice(index, 1);
return;
}
@ -399,6 +400,7 @@ export class MapHeroRenderer implements IMapHeroRenderer {
const moving = this.entities[i];
this.moveEntity(moving, last.nextDirection, DEFAULT_TIME);
}
this.entities[index].block.destroy();
this.entities.splice(index, 1);
await Promise.all(this.entities.map(v => v.promise));
return;
@ -421,10 +423,14 @@ export class MapHeroRenderer implements IMapHeroRenderer {
moving.direction = last.nextDirection;
moving.nextDirection = moving.direction;
}
this.entities[index].block.destroy();
this.entities.splice(index, 1);
}
removeAllFollowers(): void {
for (let i = 1; i < this.entities.length; i++) {
this.entities[i].block.destroy();
}
this.entities.length = 1;
}

View File

@ -167,7 +167,7 @@ export class MovingBlock extends DynamicBlockStatus implements IMovingBlock {
if (!this.end) return Promise.resolve(this);
this.time = time;
this.line = false;
this.relative = false;
this.relative = true;
this.startX = this.x;
this.startY = this.y;
this.startTime = this.renderer.getTimestamp();