refactor(animation): Canvas 레이어 z-index 정리 및 애니메이션 개선

- 캐릭터 z=2, 몬스터 z=1, 이펙트 z=3으로 레이어 순서 정리
- walking composer 업데이트
- 게임 화면 및 애니메이션 카드 개선
This commit is contained in:
JiWoong Sul
2025-12-22 16:08:10 +09:00
parent 012d4dafd2
commit f606fca063
5 changed files with 44 additions and 40 deletions

View File

@@ -24,6 +24,33 @@ enum AsciiAnimationType {
resurrection,
}
// ============================================================================
// 특수 애니메이션 타이밍 상수
// ============================================================================
/// 특수 애니메이션 프레임 수
const specialAnimationFrameCounts = {
AsciiAnimationType.levelUp: 5,
AsciiAnimationType.questComplete: 4,
AsciiAnimationType.actComplete: 4,
AsciiAnimationType.resurrection: 5,
};
/// 특수 애니메이션 프레임 간격 (밀리초)
const specialAnimationFrameIntervals = {
AsciiAnimationType.levelUp: 300,
AsciiAnimationType.questComplete: 350,
AsciiAnimationType.actComplete: 400,
AsciiAnimationType.resurrection: 600,
};
/// 특수 애니메이션 총 지속 시간 (밀리초)
int getSpecialAnimationDuration(AsciiAnimationType type) {
final frames = specialAnimationFrameCounts[type] ?? 1;
final interval = specialAnimationFrameIntervals[type] ?? 200;
return frames * interval;
}
/// TaskType을 AsciiAnimationType으로 변환
AsciiAnimationType taskTypeToAnimation(TaskType taskType) {
return switch (taskType) {

View File

@@ -115,13 +115,13 @@ class CanvasBattleComposer {
return AsciiLayer(
cells: cells,
zIndex: 1,
zIndex: 2, // 몬스터(z=1) 위에 캐릭터 표시
offsetX: charX,
offsetY: charY,
);
}
/// 몬스터 레이어 생성 (z=1)
/// 몬스터 레이어 생성 (z=1, 캐릭터보다 뒤)
AsciiLayer _createMonsterLayer(BattlePhase phase, int subFrame) {
final monsterFrames = _getAnimatedMonsterFrames(
monsterCategory,
@@ -155,7 +155,7 @@ class CanvasBattleComposer {
);
}
/// 이펙트 레이어 생성 (z=2)
/// 이펙트 레이어 생성 (z=3, 캐릭터/몬스터 위에 표시)
AsciiLayer? _createEffectLayer(BattlePhase phase, int subFrame) {
final effect = getWeaponEffect(weaponCategory);
final effectLines = _getEffectLines(effect, phase, subFrame);
@@ -176,7 +176,7 @@ class CanvasBattleComposer {
return AsciiLayer(
cells: cells,
zIndex: 2,
zIndex: 3,
offsetX: effectX,
offsetY: effectY,
);

View File

@@ -65,12 +65,7 @@ class CanvasWalkingComposer {
// 바닥 레이어(Y=7) 위에 서있도록
final charY = frameHeight - cells.length - 1;
return AsciiLayer(
cells: cells,
zIndex: 1,
offsetX: charX,
offsetY: charY,
);
return AsciiLayer(cells: cells, zIndex: 1, offsetX: charX, offsetY: charY);
}
/// 문자열 스프라이트를 AsciiCell 2D 배열로 변환
@@ -87,27 +82,11 @@ class CanvasWalkingComposer {
const _walkingFrames = [
// 프레임 1: 오른발 앞
[
r' o ',
r' /|\ ',
r' / | ',
],
[r' o ', r' /|\ ', r' /| '],
// 프레임 2: 모음
[
r' o ',
r' /|\ ',
r' / \ ',
],
[r' o ', r' /|\ ', r' |\ '],
// 프레임 3: 왼발 앞
[
r' o ',
r' /|\ ',
r' | \ ',
],
[r' o ', r' /|\ ', r' /| '],
// 프레임 4: 모음
[
r' o ',
r' /|\ ',
r' / \ ',
],
[r' o ', r' /|\ ', r' |\ '],
];