Use file-based faction unit sprites

This commit is contained in:
2026-06-25 01:08:39 +09:00
parent 2f66dd155a
commit 16eb8f0be7
40 changed files with 95 additions and 77 deletions

View File

@@ -5138,16 +5138,40 @@ export class BattleScene extends Phaser.Scene {
}
const { x, y, width, height, depth } = animation.flashArea;
const spriteX = Math.min(x + width - 46, animation.valueText.x + 34);
const spriteY = y + height / 2 + 4;
const spriteX = Math.min(x + width - 52, animation.valueText.x + 40);
const spriteY = y + height / 2 + 2;
this.createResultLevelUpBurst(spriteX, spriteY, depth + 4);
const sprite = this.trackResultObject(
this.add.sprite(spriteX, spriteY, this.unitActionTexture(animation.unit), this.unitActionFrameIndex('south', 'attack'))
this.add.sprite(spriteX, spriteY + 2, this.unitActionTexture(animation.unit), this.unitActionFrameIndex('south', this.celebrationPose(animation.unit)))
);
sprite.setDisplaySize(58, 58);
sprite.setDepth(depth + 4);
sprite.setDisplaySize(70, 70);
sprite.setDepth(depth + 6);
const banner = this.trackResultObject(this.add.text(spriteX, spriteY - 44, 'LEVEL UP', {
fontFamily: '"Malgun Gothic", "Noto Sans KR", sans-serif',
fontSize: '13px',
color: '#fff2b8',
fontStyle: '700',
stroke: '#2b1606',
strokeThickness: 3
}));
banner.setOrigin(0.5);
banner.setDepth(depth + 7);
await this.playUnitCelebrationFrames(sprite);
}
private createResultLevelUpBurst(x: number, y: number, depth: number) {
const ring = this.trackResultObject(this.add.circle(x, y + 2, 33));
ring.setStrokeStyle(3, 0xffdf7b, 0.84);
ring.setDepth(depth);
const halo = this.trackResultObject(this.add.circle(x, y + 4, 22, 0xffdf7b, 0.12));
halo.setDepth(depth - 1);
const weaponFlash = this.trackResultObject(this.add.star(x + 22, y - 28, 5, 4, 15, 0xfff2b0, 0.92));
weaponFlash.setDepth(depth + 2);
this.tweens.add({ targets: ring, angle: 180, alpha: 0, duration: 680, ease: 'Sine.easeOut' });
this.tweens.add({ targets: halo, alpha: 0.02, duration: 680, ease: 'Sine.easeOut' });
this.tweens.add({ targets: weaponFlash, y: weaponFlash.y - 12, angle: 180, alpha: 0, duration: 620, ease: 'Sine.easeOut' });
}
private flashTextColor(text: Phaser.GameObjects.Text, color: string, duration = 360) {
const previousColor = typeof text.style.color === 'string' ? text.style.color : '#f0e4c8';
text.setColor(color);
@@ -5160,20 +5184,23 @@ export class BattleScene extends Phaser.Scene {
private playUnitCelebrationFrames(sprite: Phaser.GameObjects.Sprite) {
const baseY = sprite.y;
const poses: UnitActionPose[] = ['attack', 'item', 'strategy', 'attack', 'item'];
const baseAngle = sprite.angle;
const poses: UnitActionPose[] = ['item', 'attack', 'strategy', 'attack', 'item', 'attack'];
return new Promise<void>((resolve) => {
poses.forEach((pose, index) => {
this.time.delayedCall(index * 120, () => {
this.time.delayedCall(index * 110, () => {
if (!sprite.active) {
return;
}
sprite.setFrame(this.unitActionFrameIndex('south', pose));
sprite.setY(baseY + (index % 2 === 0 ? -5 : 3));
sprite.setY(baseY + (index % 2 === 0 ? -7 : 2));
sprite.setAngle(baseAngle + (index % 2 === 0 ? -3 : 3));
});
});
this.time.delayedCall(poses.length * 120 + 80, () => {
this.time.delayedCall(poses.length * 110 + 80, () => {
if (sprite.active) {
sprite.setY(baseY);
sprite.setAngle(baseAngle);
sprite.setFrame(this.unitActionFrameIndex('south', 'item'));
}
resolve();