Files
asciinevrdie/lib/src/core/animation/background_layer.dart
JiWoong Sul 598c25e4c9 fix(animation): ASCII 애니메이션 높낮이/공백 문제 수정
- walkingAnimation, townAnimation 4줄 → 3줄 통일
- character_frames.dart 모든 프레임 폭 6자로 통일
- _compose() 이펙트 Y 위치 동적 계산 (하드코딩 제거)
- withShield() 3줄 캐릭터용으로 수정 (index 3 → index 1)
- BattleComposer 캔버스 시스템 및 배경 합성 추가
- 무기 카테고리별 이펙트, 몬스터 크기/색상 시스템 구현
2025-12-13 18:22:50 +09:00

93 lines
2.1 KiB
Dart

// 배경 레이어 시스템 (ASCII Patrol 스타일 패럴렉스)
// 각 환경은 여러 레이어로 구성되며, 레이어마다 다른 스크롤 속도를 가짐
/// 배경 레이어 데이터
class BackgroundLayer {
const BackgroundLayer({
required this.lines,
required this.scrollSpeed,
this.yStart = 0,
});
/// 레이어 패턴 (각 줄은 반복 가능한 패턴)
final List<String> lines;
/// 스크롤 속도 (0.0 = 정지, 1.0 = 최고속)
/// 원경일수록 느리게, 전경일수록 빠르게
final double scrollSpeed;
/// 시작 Y 위치 (0~7)
final int yStart;
}
/// 환경 타입
enum EnvironmentType {
/// 마을 - 건물 실루엣
town,
/// 숲 - 나무
forest,
/// 동굴 - 바위
cave,
/// 던전 - 벽돌
dungeon,
/// 기술 - 회로
tech,
/// 보이드 - 별/공허 (보스)
void_,
}
/// TaskType과 몬스터 이름에서 환경 타입 추론
EnvironmentType inferEnvironment(String? taskType, String? monsterName) {
// 마을 관련 태스크
if (taskType == 'heading' || taskType == 'buyEquip') {
return EnvironmentType.town;
}
// 몬스터 이름에서 환경 추론
if (monsterName != null) {
final lower = monsterName.toLowerCase();
// 보이드/우주
if (lower.contains('void') ||
lower.contains('cosmic') ||
lower.contains('star') ||
lower.contains('galaxy')) {
return EnvironmentType.void_;
}
// 기술/사이버
if (lower.contains('cyber') ||
lower.contains('robot') ||
lower.contains('ai') ||
lower.contains('data') ||
lower.contains('server')) {
return EnvironmentType.tech;
}
// 언데드/던전
if (lower.contains('zombie') ||
lower.contains('skeleton') ||
lower.contains('ghost') ||
lower.contains('undead') ||
lower.contains('dungeon')) {
return EnvironmentType.dungeon;
}
// 동굴
if (lower.contains('cave') ||
lower.contains('bat') ||
lower.contains('spider') ||
lower.contains('worm')) {
return EnvironmentType.cave;
}
}
// 기본: 숲
return EnvironmentType.forest;
}