refactor(animation): 애니메이션 시스템 정리

- AsciiCanvasPainter, CanvasBattleComposer 개선
- WeaponEffects 정리
This commit is contained in:
JiWoong Sul
2026-01-12 16:17:11 +09:00
parent 6f70c18d08
commit a404c82f35
3 changed files with 28 additions and 12 deletions

View File

@@ -161,7 +161,16 @@ class AsciiCanvasPainter extends CustomPainter {
final y = gridY * cellHeight; final y = gridY * cellHeight;
// 레이어 투명도를 셀 렌더링에 전달 // 레이어 투명도를 셀 렌더링에 전달
_drawCell(canvas, cell, x, y, cellWidth, cellHeight, fontSize, layer.opacity); _drawCell(
canvas,
cell,
x,
y,
cellWidth,
cellHeight,
fontSize,
layer.opacity,
);
} }
} }
} }

View File

@@ -92,7 +92,8 @@ class CanvasBattleComposer {
// 텍스트 이펙트 레이어 (Phase 10~11) // 텍스트 이펙트 레이어 (Phase 10~11)
// 크리티컬 텍스트 (상단 중앙) // 크리티컬 텍스트 (상단 중앙)
if (isCritical && (phase == BattlePhase.attack || phase == BattlePhase.hit)) { if (isCritical &&
(phase == BattlePhase.attack || phase == BattlePhase.hit)) {
layers.add(_createCriticalTextLayer(subFrame)); layers.add(_createCriticalTextLayer(subFrame));
} }
// 회피 텍스트 (캐릭터 위) // 회피 텍스트 (캐릭터 위)
@@ -410,7 +411,10 @@ class CanvasBattleComposer {
final List<List<AsciiCell>> cells; final List<List<AsciiCell>> cells;
if (attacker == AttackerType.player && weaponRarity != null) { if (attacker == AttackerType.player && weaponRarity != null) {
// 무기 등급에 따른 이펙트 색상 // 무기 등급에 따른 이펙트 색상
cells = _spriteToCellsWithColor(effectLines, weaponRarity!.effectCellColor); cells = _spriteToCellsWithColor(
effectLines,
weaponRarity!.effectCellColor,
);
} else { } else {
// 기본 색상 (자동 색상 결정) // 기본 색상 (자동 색상 결정)
cells = _spriteToCells(effectLines); cells = _spriteToCells(effectLines);
@@ -533,19 +537,16 @@ class CanvasBattleComposer {
}).toList(); }).toList();
}).toList(); }).toList();
return AsciiLayer( return AsciiLayer(cells: cells, zIndex: 4, offsetX: offsetX, offsetY: 0);
cells: cells,
zIndex: 4,
offsetX: offsetX,
offsetY: 0,
);
} }
/// 몬스터 공격 이펙트 (← 방향) /// 몬스터 공격 이펙트 (← 방향)
List<String> _getMonsterAttackEffect(BattlePhase phase, int subFrame) { List<String> _getMonsterAttackEffect(BattlePhase phase, int subFrame) {
return switch (phase) { return switch (phase) {
BattlePhase.prepare => _monsterPrepareFrames[subFrame % _monsterPrepareFrames.length], BattlePhase.prepare =>
BattlePhase.attack => _monsterAttackFrames[subFrame % _monsterAttackFrames.length], _monsterPrepareFrames[subFrame % _monsterPrepareFrames.length],
BattlePhase.attack =>
_monsterAttackFrames[subFrame % _monsterAttackFrames.length],
BattlePhase.hit => _monsterHitFrames[subFrame % _monsterHitFrames.length], BattlePhase.hit => _monsterHitFrames[subFrame % _monsterHitFrames.length],
_ => <String>[], _ => <String>[],
}; };

View File

@@ -104,7 +104,13 @@ const _projectileEffect = WeaponEffect(
[r' ', r' . ', r' [> ', r" ' ", r' '], [r' ', r' . ', r' [> ', r" ' ", r' '],
[r' ', r' . ', r' [> ', r" ' ", r' '], [r' ', r' . ', r' [> ', r" ' ", r' '],
[r' ', r' . ', r' [>', r" ' ", r' '], [r' ', r' . ', r' [>', r" ' ", r' '],
[r' ', r' ', r' [>', r' ', r' '], [
r' ',
r' ',
r' [>',
r' ',
r' ',
],
], ],
hitFrames: [ hitFrames: [
[r' *CLANG!* ', r' ***', r' [>', r' ***', r' '], [r' *CLANG!* ', r' ***', r' [>', r' ***', r' '],