Recenter camera after enemy turn

This commit is contained in:
2026-07-01 03:11:59 +09:00
parent edbe0b0214
commit 7b27d7aa9a

View File

@@ -3407,6 +3407,15 @@ export class BattleScene extends Phaser.Scene {
this.setCameraTilePosition(x - Math.floor(this.layout.visibleColumns / 2), y - Math.floor(this.layout.visibleRows / 2));
}
private centerCameraOnAllyLine() {
const focusUnit =
battleUnits.find((unit) => unit.id === 'liu-bei' && unit.hp > 0) ??
battleUnits.find((unit) => unit.faction === 'ally' && unit.hp > 0);
if (focusUnit) {
this.centerCameraOnTile(focusUnit.x, focusUnit.y);
}
}
private setCameraTilePosition(x: number, y: number, refresh = true) {
const nextX = Phaser.Math.Clamp(Math.round(x), 0, this.maxCameraTileX());
const nextY = Phaser.Math.Clamp(Math.round(y), 0, this.maxCameraTileY());
@@ -8928,6 +8937,7 @@ export class BattleScene extends Phaser.Scene {
this.updateTurnText();
this.updateObjectiveTracker();
this.checkBattleEvents();
this.centerCameraOnAllyLine();
this.renderRosterPanel('ally', [`${this.turnNumber}턴 아군 차례입니다.`, recoveryMessage, '행동할 장수를 선택하세요.'].filter(Boolean).join('\n'));
}