Recenter camera after enemy turn
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user