From 2a4ca2a7bf4512b267fc7aeb913f719fa37bccd2 Mon Sep 17 00:00:00 2001 From: swrring Date: Tue, 24 Nov 2026 20:40:39 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A1=B0=EC=A4=80=20=C2=B7=20=EC=82=AC?= =?UTF-8?q?=EA=B1=B0=EB=A6=AC=20=C2=B7=20=EC=8A=A4=ED=82=AC=20=EB=B2=94?= =?UTF-8?q?=EC=9C=84=20=EC=9D=B8=EB=94=94=EC=BC=80=EC=9D=B4=ED=84=B0(PD=20?= =?UTF-8?q?2026-11-23~24=20=C2=B7=20=EC=9D=B8=EA=B3=84=EC=84=9C=20=C2=A70-?= =?UTF-8?q?AO=201=EC=B0=A8=E2=91=A3=20=C2=B7=202=EC=B0=A8=20=C2=B7=203?= =?UTF-8?q?=EC=B0=A8=20=C2=B7=205=EC=B0=A8=E2=91=A1=20=C2=B7=207=EC=B0=A8?= =?UTF-8?q?=20=C2=B7=20PD=20=E3=80=8C=EC=8A=A4=ED=82=AC=20=EB=B2=94?= =?UTF-8?q?=EC=9C=84=20=EA=B0=9C=EC=84=A0=20=EA=B4=80=EB=A0=A8=20=EC=9D=B8?= =?UTF-8?q?=EB=94=94=EC=BC=80=EC=9D=B4=ED=84=B0=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=EC=9D=84=20=ED=91=B8=EC=8B=9C=ED=95=B4?= =?UTF-8?q?=EC=A4=98=E3=80=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 최대 파워로 공격이 닿는 적 강조 · 조준 공격 색(SlingshotInput · IbAimArrow.AttackShown) - 사거리 원 = 벡터 선(RangeIndicator · ProceduralSprites 원판 · 빛 고리 · 점선 · 꺾쇠) - 스킬 시전 범위 = 새 부품 VectorRing(청록 원형 인디케이터 · 표 skill_ind_*) - 스킬 모양 인디케이터 = 새 부품 SkillShapeIndicator(직선 · 부채꼴 · 떨어질 자리 원) · ActionResolver.SkillAim(실제 사격과 같은 질의) · 새 표 Resources/Skills/skill_indicator.csv(효과 키 → 모양 · 켬) - 부채꼴 = 하후연 전광 연사(shot_fan)만 켬 · 삼연시(multishot) 꺼 둠(PD 「우선 하후연에만」) - 조준 중 조작 영웅 = 화살표 위 · 다른 유닛 = 화살표 아래(UnitView.SetAiming · 모든 조준 방식) - 값 = ib_ui.csv(range_* · skill_range_* · skill_ind_* · skill_line_* · skill_sector_*) - 시험 = BattleFlowTests.SkillShape_ReservedShot_TableShape_UnderUnits · MissionTests.Capture_BattleHud 캡처 09~20 검증(열린 에디터 · 이 커밋 전 작업 트리) = 재컴파일 오류 0 · 새 콘솔 오류 0 · SkillShape 1/1 · RangeIndicator 1/1 · TacticalAITests 15/15 · UILayerTests 2/2 · Fable QA r2 PASS 뺀 것(로컬 미커밋 유지) = 탑바 · 결과 화면 · 부제 포장 · 중단 팝업 · 전리품 수(BattleHUD · BattleManager · BattleResultPanel · battle_hud.csv · battle_text.csv · UITheme · 아틀라스 · 새 battle 그림) · Gimmick 에셋 · packages-lock Co-Authored-By: Claude Opus 5.5 --- Assets/Resources/Skills/ib_ui.csv | 60 ++- Assets/Resources/Skills/skill_indicator.csv | 12 + .../Resources/Skills/skill_indicator.csv.meta | 7 + .../Scripts/Runtime/ActionResolver.Skills.cs | 106 +++++ Assets/Scripts/Runtime/IbAimArrow.cs | 5 +- Assets/Scripts/Runtime/ProceduralSprites.cs | 159 +++++++ Assets/Scripts/Runtime/RangeIndicator.cs | 209 ++++++++- Assets/Scripts/Runtime/SkillShapeIndicator.cs | 442 ++++++++++++++++++ .../Runtime/SkillShapeIndicator.cs.meta | 2 + Assets/Scripts/Runtime/SlingshotInput.cs | 172 ++++++- Assets/Scripts/Runtime/UnitView.cs | 3 +- Assets/Scripts/Runtime/VectorRing.cs | 148 ++++++ Assets/Scripts/Runtime/VectorRing.cs.meta | 2 + Assets/Tests/PlayMode/BattleFlowTests.cs | 58 +++ Assets/Tests/PlayMode/MissionTests.cs | 156 +++++++ 15 files changed, 1514 insertions(+), 27 deletions(-) create mode 100644 Assets/Resources/Skills/skill_indicator.csv create mode 100644 Assets/Resources/Skills/skill_indicator.csv.meta create mode 100644 Assets/Scripts/Runtime/SkillShapeIndicator.cs create mode 100644 Assets/Scripts/Runtime/SkillShapeIndicator.cs.meta create mode 100644 Assets/Scripts/Runtime/VectorRing.cs create mode 100644 Assets/Scripts/Runtime/VectorRing.cs.meta diff --git a/Assets/Resources/Skills/ib_ui.csv b/Assets/Resources/Skills/ib_ui.csv index 9466921a..86baf0d7 100644 --- a/Assets/Resources/Skills/ib_ui.csv +++ b/Assets/Resources/Skills/ib_ui.csv @@ -49,7 +49,7 @@ drag_tone_right,0.86,끌기 화살표: 오른쪽 반쪽 밝기(기존 화살표 drag_arrow_alpha,0.87,끌기 화살표: 불투명도(기존 그림 몸통 222/255) drag_outline_color,#FFFFFF47,끌기 화살표: 테두리 선 색(기존 화살표 테두리 실측 = 흰색 · 평균 불투명도 26 % → 28 % · PD 2026-11-18 「아웃라인이 너무 튄다」) drag_outline_w,0.022,끌기 화살표: 테두리 선 두께(월드 · 도형 안쪽으로 절반 들여 그림) -drag_aim_unit_lift,13,끌기: 조준 중인 유닛 그림·체력 바 정렬을 이만큼 올림 = 화살표(order_arrow 10 · 테두리 11) 위 · 다른 유닛은 화살표 아래(PD 2026-11-18) +drag_aim_unit_lift,13,조준(끌기 · 게이지 모두 · PD 2026-11-24): 조준 중인 유닛 그림·체력 바 정렬을 이만큼 올림 = 화살표(order_arrow 10 · 테두리 11) 위 · 다른 유닛은 화살표 아래(PD 2026-11-18) crit_sweep_sec,0.45,끌기(PD 2026-11-18 「치명타가 너무 쉬움 · 게이지 더 빠르게」 · 혼합안 0.6 → 0.45): 표시선이 막대 바닥 → 끝(한 방향) 가는 시간(초) · 오르내림 반복 · 게이지 시간 % 스킬은 같은 비율로 늦춤 hit_zone_ranged,0.7,끌기(Fable 혼합안 · 전 0.45 · 검정 칸 = 이동은 유지 — PD 「전술적 후퇴」): 원거리(궁·책) 노란 명중 칸 높이(막대 대비 · 자리 무작위) · 명중·치명타 칸 = 적이 없어도 제자리 발사(최대 사거리에서 소멸) · 그 밖 검정 = 공격 없이 이동 · 근접 = 막대 전체 명중 crit_zone_size,0.13,끌기(PD 2026-11-18 「판정 좁게」 · 혼합안 0.2 → 0.13 · 노릴 시간 ≈ 0.13 × 0.45 = 0.06초): 빨간 치명타 칸 높이(막대 대비 · 회색 안 무작위 자리) @@ -69,3 +69,61 @@ edge_fog_in,0.8,구름이 배경 그림 끝에서 안쪽으로 들어오는 폭( edge_fog_out,6,구름 조각을 배경 그림 끝 밖으로 까는 폭(월드 · 그보다 먼 곳은 edge_fog_base 색) edge_fog_drift,0.18,구름 띠가 천천히 흔들리는 폭(월드 · 0 = 멈춤) edge_fog_drift_sec,9,구름 띠가 한 번 흔들리는 시간(초) +range_style,2,사거리 원 모양(PD 2026-11-23 「해상도가 떨어지는 굵은 베이지색 원형 선 → 개선」 · 0 = 예전 그림 고리 · 1 = 또렷한 점선 고리 + 아주 옅은 바탕 · 2 = 실선 + 가장자리가 진한 은은한 원판 · 3 = 실선 + 안쪽 눈금 + 공격 가능한 적 방향 꺾쇠) · 선 = 벡터(화면 두께 일정) +range_line_px,5,사거리 원 선 두께(기준 1080×1920 화면 px · UI 와 같이 화면 크기에 맞춰 커짐) +range_color,#FFF3D6E6,사거리 원 색(공격 가능한 적 없음 · 따뜻한 흰색) +range_color_attack,#FF5A3CF2,사거리 원 색(사정거리 안에 공격 가능한 적이 있음 = 조준 공격 화살표와 같은 붉은색 · PD 2026-11-23 2차 「사정거리 내 공격 가능한 적이 있을 때 변화」) +range_dash_px,22,점선 한 칸 길이(화면 px · 모양 1) +range_dash_fill,0.6,점선 한 칸 중 선 비율(모양 1) +range_fill_alpha,0.08,모양 1 바탕 원판 불투명도 +range_disc_alpha,0.15,모양 2 원판 가장자리 불투명도(가운데 투명 → 가장자리) +range_pulse_sec,1.2,공격 가능할 때 숨쉬기 주기(초) +range_pulse_min,0.6,숨쉬기 최소 밝기(1 = 숨쉬기 없음) +range_tick_count,36,모양 3 안쪽 눈금 수 +range_tick_px,14,모양 3 눈금 길이(화면 px) +range_chevron_px,54,모양 3 공격 가능한 적 방향 꺾쇠 크기(화면 px) +range_under_color,#3A24145A,사거리 원 받침 선 색(짙은 고동 반투명 · 밝은 모래 위에서도 선이 보이게 · QA M5) +range_under_px,2,받침 선이 선보다 두꺼운 양(화면 px) +skill_range_color,#FFC940F2,스킬 시전 범위 선 색(금 · PD 2026-11-23 「스킬 시전 범위도 수정」 · 선택한 영웅 스킬 반경 · 스킬 지점 선택 반경 = 벡터 실선 + 받침 선 + 은은한 원판 · 사거리 원 모양 2 와 같은 방식) +skill_range_px,4,스킬 시전 범위 선 두께(기준 화면 px) +skill_range_disc_alpha,0.1,스킬 반경 원판 가장자리 불투명도(선택한 영웅 · 사거리 원판과 겹쳐서 옅게) +skill_area_disc_alpha,0.16,스킬 지점 선택 반경 원판 가장자리 불투명도 +skill_ind_style,1,스킬 시전 범위 모양(PD 2026-11-24 「예시와 같은 공격 인디케이터 형태」 · 1 = 원형 공격 인디케이터(빛나는 바깥 고리 띠 + 안쪽 이중 가는 고리 + 가운데 바닥 빛 + 중심 표적 + 숨쉬기) · 0 = 실선 + 은은한 원판) +skill_ind_line_px,7,인디케이터 바깥 고리 선 두께(화면 px) +skill_ind_glow,0.7,인디케이터 바깥 빛 띠 불투명도(가장자리에서 안쪽으로 옅어짐) +skill_ind_center,0.3,인디케이터 가운데 바닥 빛 불투명도 +skill_ind_inner,0.8,안쪽 이중 고리 위치(반지름 비율) +skill_ind_reticle_px,110,중심 표적 크기(화면 px) +skill_ind_pulse_sec,1.4,인디케이터 숨쉬기 주기(초) +skill_ind_color,#40D8FFFF,인디케이터 색(청록 · 예시와 같은 계열 · 밝은 모래 바닥에서 금색은 묻힘(1차 캡처 실측) · 사거리 원 흰색 · 공격 가능 붉은색과도 구별) +skill_ind_under_color,#0B3A4A8C,인디케이터 받침 선 색(짙은 청록 반투명 · 모래 위 대비) +skill_shape_order,-6,조준 중 스킬 범위(직선 · 부채꼴 · 떨어질 자리 원) 선 정렬 값(PD 2026-11-24 「레이어를 영웅보다 하단」 · 유닛 = 0 보다 작아야 함 · 채움 = 이 값 −2 · 받침 선 −1 · 사거리 원 −8 ~ −11 위) +skill_line_color,#40D8FFFF,직선 인디케이터 색(PD 2026-11-24 예시 · 원형 인디케이터와 같은 청록) +skill_line_under_color,#0B3A4A8C,직선 인디케이터 받침 선 색(짙은 청록 반투명 · 모래 위 대비) +skill_line_px,6,직선 양옆 줄 · 화살촉 테두리 두께(기준 화면 px · QA r1 M3 = 원형과 결 맞춤 5 → 6) +skill_line_alpha_head,1,양옆 줄 불투명도(화살촉 쪽) +skill_line_alpha_tail,0,양옆 줄 불투명도(쏘는 영웅 쪽 끝 = 옅어짐 · PD 예시) +skill_line_fill_head,0.45,띠 채움 불투명도(화살촉 쪽 · 가장자리 · QA r1 B1 0.32 → 0.45) +skill_line_fill_tail,0,띠 채움 불투명도(쏘는 영웅 쪽) +skill_line_fill_center,0.55,띠 가운데 불투명도 배율(가장자리가 진하고 가운데 옅게 = 원형 인디케이터 원판과 같은 결) +skill_line_head_fill,0.45,화살촉 채움 불투명도 +skill_line_min_half_px,18,띠 반폭 최소(화면 px · 실제 맞는 폭이 이보다 좁으면 이만큼 그림) +skill_line_head_len,1.3,화살촉 길이 = 띠 반폭 × 이 값(최소 skill_line_head_min_px · 길이의 45 % 넘지 않음) +skill_line_head_min_px,40,화살촉 최소 길이(화면 px) +skill_line_head_width,1.6,화살촉 반폭 = 띠 반폭 × 이 값 +skill_sector_color,#FF5A3CFF,부채꼴 인디케이터 색(PD 2026-11-24 예시 = 붉은 부채꼴 · 사거리 원 공격 색과 같은 붉은색) +skill_sector_under_color,#4A100A8C,부채꼴 받침 선 색(짙은 적갈 반투명) +skill_sector_line_px,5,부채꼴 테두리 두께(화면 px · 안쪽 호 = 0.45 배 · QA r1 M6 6 → 5) +skill_sector_fill_edge,0.5,부채꼴 채움 불투명도(호 쪽 = 진함 · QA r1 M6) +skill_sector_fill_mid,0.2,부채꼴 채움 불투명도(빛 띠 안쪽 끝 · QA r1 M6 0.1 → 0.2) +skill_sector_fill_center,0.06,부채꼴 채움 불투명도(중심 = 영웅 발밑) +skill_sector_glow_frac,0.3,호 쪽 빛 띠 폭(반지름 비율) +skill_sector_default_angle,60,부채꼴 각(도 · 스킬 값이 없을 때 · 하후연 = 표 p3) +skill_sector_dot_px,70,부채꼴 중심점 크기(화면 px · 영웅 그림 밑에 깔림 · 0 = 없음) +skill_line_view_top_px,210,직선을 그리는 위쪽 한계 = 화면 위끝에서 이만큼 아래(화면 px · 탑바 · 턴 현판 밑에 화살촉이 숨지 않게 · 레이저 = 화면 끝까지라 1배 캡처에서 탑바 밑에 묻혔음) +skill_line_view_bottom_px,600,직선을 그리는 아래쪽 한계 = 화면 아래끝에서 이만큼 위(화면 px · 영웅 정보판 + 예약 스킬 설명 칸 위) +skill_line_view_side_px,24,직선을 그리는 좌우 한계(화면 px) +skill_line_fade_frac,1,띠가 화살촉 쪽(진함)에서 쏘는 영웅 쪽(옅음)으로 옅어지는 길이 비율(1 = 띠 전체 · QA r1 B1 · PD 예시 = 끝으로 갈수록 옅어지는 띠) +skill_line_side_fade_frac,0.45,양옆 줄이 쏘는 영웅 쪽 끝에서 옅어지는 길이 비율(줄 길이 기준) +skill_line_band_frac,0.7,띠 반폭 = 양옆 줄 간격의 이 비율(띠와 줄 사이 틈 · QA r1 M5 · PD 예시 세 줄 구조) +skill_line_fill_color,#96EBF5FF,띠 · 화살촉 속 색(밝은 청록 · 진한 청록을 반투명으로 모래에 깔면 탁한 회갈색이 됨 = QA r1 M2 실측) diff --git a/Assets/Resources/Skills/skill_indicator.csv b/Assets/Resources/Skills/skill_indicator.csv new file mode 100644 index 00000000..725b109a --- /dev/null +++ b/Assets/Resources/Skills/skill_indicator.csv @@ -0,0 +1,12 @@ +s_key,shape,on,Memo +# 스킬 범위 모양 표(PD 2026-11-24 「부채꼴 · 직선 인디케이터 + 스킬 범위까지 게임에 모두 반영」) — 읽는 곳 = TKS.SkillIndicatorTable(SkillShapeIndicator · RangeIndicator · SlingshotInput) · 모양 = circle(원형 공격 인디케이터) | sector(부채꼴) | line(직선 · 끝에 화살촉) | none · on 0 = 그리지 않음 · 길이 · 폭 · 각 = 실제 사격과 같은 질의(ActionResolver.SkillAim) · 색 · 두께 = ib_ui.csv skill_ind_* · skill_line_* · skill_sector_* +radius,circle,1,자신 둘레 반경 액티브(관우 청룡언월 등 · 영웅을 고르면 발밑 · RangeIndicator) · 원 모양만 +point,circle,1,스킬 지점 선택 범위(장합 변진 · 맹장 복귀 · SlingshotInput.RefreshTeleportArea) · 원 모양만 +shot_laser,line,1,레이저(태사자 · 조범) · 쏜 자리 → 지금 보이는 화면 끝(벽에서 멈춤) · 폭 = 몸 반지름 × 0.9(맞는 띠) +shot_pierce,line,1,직선 관통(장임 · 왕랑 · 주태 검기) · 사거리 + 몸 반지름(벽에서 멈춤) · 폭 = 몸 반지름 × 0.9 +shot_giant,line,1,거대 화살(황충) · 사거리 무관 · 첫 적 또는 벽까지 · 폭 = 화살 반지름 p1 +shot_whirl,line,1,회오리(제갈근) · 사거리 + 몸 반지름 · 폭 = 반폭 p1 +shot_firewall,line,1,불 장벽(육손) · 몸 앞 p1 ~ 당긴 세기만큼(벽에서 멈춤) · 폭 = 반폭 p1 +shot_fan,sector,1,부채꼴 연속 사격(하후연) · 각 = p3(도) · 반지름 = 사거리 + 몸 반지름 · PD 2026-11-24 「우선 하후연에만 · 추후 부채꼴로 동작하는 영웅이 생기면 그 효과 키 줄 추가」 +shot_blast,circle,1,폭발 사격(서서 · 가후 · 주유 · 손권) · 떨어질 자리(첫 적 또는 사거리 끝 · 승병 = 당긴 세기) 원 · 반지름 = p1 × 광역 배율 +multishot,sector,0,멀티샷(하후연 패시브 삼연시 · 일반 사격 = 부채꼴 p1 발 · 각 = p2 · 궁병만) · 조준할 때마다 뜸 · 꺼 둠(PD 2026-11-24 「우선 하후연에만」 = 전광 연사만 · 1 = 켬) diff --git a/Assets/Resources/Skills/skill_indicator.csv.meta b/Assets/Resources/Skills/skill_indicator.csv.meta new file mode 100644 index 00000000..1721e233 --- /dev/null +++ b/Assets/Resources/Skills/skill_indicator.csv.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3f99c703a5aeabd4494c633030f91a14 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Runtime/ActionResolver.Skills.cs b/Assets/Scripts/Runtime/ActionResolver.Skills.cs index 68ee54c1..c6651a32 100644 --- a/Assets/Scripts/Runtime/ActionResolver.Skills.cs +++ b/Assets/Scripts/Runtime/ActionResolver.Skills.cs @@ -24,6 +24,112 @@ namespace TKS return false; } + /// 조준 중 스킬 범위 모양(PD 2026-11-24 「스킬 범위까지 게임에 모두 반영」) — 실제 사격()과 같은 궤적 질의로 잰 값 · 그리는 모양 = 표 skill_indicator.csv. + public struct SkillAimShape + { + /// 효과 키(shot_laser · shot_fan …) = 표 skill_indicator.csv 의 줄. + public string Key; + /// 직선 · 부채꼴이 시작하는 자리(쏘는 유닛 가운데 · 불 장벽 = 장벽 시작점). + public Vector2 From; + public Vector2 Dir; + /// 직선 길이 · 부채꼴 반지름(월드). + public float Length; + /// 직선 반폭 = 맞는 띠의 반(월드). + public float HalfWidth; + /// 부채꼴 전체 각(도). + public float Angle; + /// 원 가운데 · 반지름(폭발 사격 = 떨어질 자리). + public Vector2 Center; + public float Radius; + } + + /// + /// 예약한 특수 사격의 범위 모양 — 순서 · 길이 · 폭 = 과 같다(거대 화살 = 첫 적 또는 벽 · 관통 = 사거리 · 레이저 = 보이는 화면 끝 · 폭발 = 떨어질 자리 원 · + /// 부채꼴 = p3 도 · 사거리 · 회오리 · 불 장벽 = 반폭 p1). 이동만 남았거나 특수 사격이 없으면 false. + /// + public bool SkillAim(Unit u, Vector2 aim, out SkillAimShape s) + { + s = default(SkillAimShape); + if (u == null || u.BonusMoveAvailable) return false; + Vector2 delta = aim - u.Position; + if (delta.sqrMagnitude < 1e-6f) return false; + Vector2 dir = delta.normalized; + var skills = SkillSystem.Current; + bool prev = skills != null && skills.PreviewBegin(u); // 예약(Reserved)만 된 스킬을 잠깐 장착해 효과를 읽음(PreviewShot 과 같음) + GimmickLayer.PreviewMode = true; + try + { + s.From = u.Position; + s.Dir = dir; + SkillEffect e; + float travel; + if (!HasSpecialShot(u)) + { + // 멀티샷(하후연 패시브 · 일반 사격 = 부채꼴 p1 발 · 전체 각 p2) = 표 skill_indicator.csv multishot 줄(지금 꺼 둠 · 쓸지 = PD 결정) + if (u.Type != UnitType.Archer || (e = SkillMods.First(u, SkillKeys.Multishot)) == null) return false; // 실제 사격과 같은 조건(궁병만) + s.Key = SkillKeys.Multishot; + s.Angle = e.Get(1, 30f); + s.Length = SkillMods.Range(u) + u.Radius; + return true; + } + if ((e = SkillMods.First(u, SkillKeys.ShotGiant)) != null) + { + s.Key = SkillKeys.ShotGiant; + TraceGiant(u, u.Position, dir, e, out travel); + s.Length = travel; + s.HalfWidth = Mathf.Max(cfg.arrowRadius, e.P); + } + else if (SkillMods.Has(u, SkillKeys.ShotPierce) || SkillMods.Has(u, SkillKeys.ShotLaser)) + { + bool laser = !SkillMods.Has(u, SkillKeys.ShotPierce); + s.Key = laser ? SkillKeys.ShotLaser : SkillKeys.ShotPierce; + TracePierce(u, u.Position, dir, laser, new List(), out travel); + s.Length = travel; + s.HalfWidth = u.Radius * Combat.CastRadiusScale; // UnitsOnPath 원 투사 반지름 + } + else if ((e = SkillMods.First(u, SkillKeys.ShotBlast)) != null) + { + s.Key = SkillKeys.ShotBlast; + Vector2 c; + float r; + TraceBlast(u, u.Position, dir, aim, e, false, out c, out r); + s.Center = c; + s.Radius = r; + s.Length = Vector2.Distance(u.Position, c); + } + else if ((e = SkillMods.First(u, SkillKeys.ShotFan)) != null) + { + s.Key = SkillKeys.ShotFan; + s.Angle = e.Get(2, 30f); + s.Length = SkillMods.Range(u) + u.Radius; // 화살마다 FireOne 사거리 + } + else if ((e = SkillMods.First(u, SkillKeys.ShotWhirl)) != null) + { + s.Key = SkillKeys.ShotWhirl; + s.Length = Combat.WallTravel(u, u.Position, dir, SkillMods.Range(u) + u.Radius); + s.HalfWidth = e.P; + } + else if (SkillMods.Has(u, SkillKeys.ShotBarricade)) return false; // 목책 = 세우는 자리 모양(직선 · 부채꼴 · 원 아님) → 표 연결 없음 + else if ((e = SkillMods.First(u, SkillKeys.ShotFirewall)) != null) + { + s.Key = SkillKeys.ShotFirewall; + float range = PowerReach(u, aim, SkillMods.Range(u) + u.Radius); + float a0 = u.Radius + e.P; + float b0 = Mathf.Max(a0, Combat.WallTravel(u, u.Position, dir, range)); + s.From = u.Position + dir * a0; + s.Length = b0 - a0; + s.HalfWidth = e.P; + } + else return false; + return true; + } + finally + { + GimmickLayer.PreviewMode = false; + if (skills != null) skills.PreviewEnd(u, prev); + } + } + IEnumerator SpecialShot(Unit u, Vector2 origin, Vector2 dir, Vector2 target, ActionOutcome o) { o.Fired = true; diff --git a/Assets/Scripts/Runtime/IbAimArrow.cs b/Assets/Scripts/Runtime/IbAimArrow.cs index d911ca1a..311aa528 100644 --- a/Assets/Scripts/Runtime/IbAimArrow.cs +++ b/Assets/Scripts/Runtime/IbAimArrow.cs @@ -256,7 +256,10 @@ namespace TKS Color campColor = Color.white; bool attackOn; - /// 원거리 화살표 끝 규칙: 조준점이 적에 닿아 사격이 나가는 동안 화살표를 공격 색(표 aim_arrow_color_attack)으로 · 아니면 진영 색(이동). + /// 지금 화살표가 공격 색인가(시험용). + public bool AttackShown { get { return attackOn; } } + + /// 조준으로 공격이 나가는 동안 화살표를 공격 색(표 aim_arrow_color_attack)으로 · 아니면 진영 색(이동) — 원거리 = 화살표 끝 규칙 · 근접 · 기병 = 예상 대상(PD 2026-11-23). public void SetAttack(bool on) { if (arrow == null || on == attackOn) return; diff --git a/Assets/Scripts/Runtime/ProceduralSprites.cs b/Assets/Scripts/Runtime/ProceduralSprites.cs index fb526cf6..7b61c7ed 100644 --- a/Assets/Scripts/Runtime/ProceduralSprites.cs +++ b/Assets/Scripts/Runtime/ProceduralSprites.cs @@ -22,6 +22,165 @@ namespace TKS } } + static Sprite softDisc; + static Sprite chevron; + static Texture2D dashTex; + + /// + /// 지름 1 의 은은한 원판(가운데 투명 → 가장자리로 갈수록 진해지고 끝은 부드럽게 끊김 · 512 px) — 사거리 원판(표 ib_ui range_style 2). + /// 부드러운 그라데이션이라 크게 늘려도 계단이 보이지 않는다. + /// + public static Sprite SoftDisc + { + get + { + if (softDisc != null) return softDisc; + const int size = 512; + var tex = new Texture2D(size, size, TextureFormat.RGBA32, false) { wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Bilinear }; + float half = size * 0.5f; + var px = new Color[size * size]; + for (int y = 0; y < size; y++) + for (int x = 0; x < size; x++) + { + float d = Mathf.Sqrt((x + 0.5f - half) * (x + 0.5f - half) + (y + 0.5f - half) * (y + 0.5f - half)) / half; + float a = Mathf.SmoothStep(0f, 1f, Mathf.InverseLerp(0.35f, 1f, d)) * Mathf.Clamp01((1f - d) * half); + px[y * size + x] = new Color(1f, 1f, 1f, a); + } + tex.SetPixels(px); + tex.Apply(); + tex.hideFlags = HideFlags.DontSave; + softDisc = Sprite.Create(tex, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f), size); + softDisc.hideFlags = HideFlags.DontSave; + return softDisc; + } + } + + static Sprite glowRing; + static Sprite radialGlow; + static Sprite reticle; + + /// + /// 지름 1 의 빛나는 고리 띠(공격 인디케이터 바깥 빛 · PD 2026-11-24 예시) — 가장자리(0.97)에서 가장 진하고 안쪽으로 0.18 만큼 부드럽게 옅어짐 · 바깥은 짧게 끊김(512 px). + /// + public static Sprite GlowRing + { + get + { + if (glowRing != null) return glowRing; + glowRing = MakeRadial(512, d => d > 1f ? 0f : d >= 0.97f ? Mathf.Clamp01((1f - d) / 0.03f) : Mathf.Pow(Mathf.Clamp01(1f - (0.97f - d) / 0.18f), 2f)); + return glowRing; + } + } + + /// 지름 1 의 가운데 빛(가운데 진함 → 가장자리 0 · 512 px) — 공격 인디케이터 바닥 빛. + public static Sprite RadialGlow + { + get + { + if (radialGlow != null) return radialGlow; + radialGlow = MakeRadial(512, d => d >= 1f ? 0f : Mathf.Pow(1f - d, 2.2f)); + return radialGlow; + } + } + + /// 중심 표적(네 방향 별 + 고리 둘 + 가운데 점 · 256 px · 크기 1) — 공격 인디케이터 가운데(시전 중심). + public static Sprite Reticle + { + get + { + if (reticle != null) return reticle; + reticle = MakeRadialXY(256, (x, y) => + { + float d = Mathf.Sqrt(x * x + y * y); + float a = 0f; + // 네 방향 별(가로 · 세로 마름모 가시) + float ax = Mathf.Abs(x), ay = Mathf.Abs(y); + float spike = Mathf.Max(Mathf.Clamp01((0.11f * (1f - ax / 0.95f) - ay) * 60f), Mathf.Clamp01((0.11f * (1f - ay / 0.95f) - ax) * 60f)); + a = Mathf.Max(a, spike); + a = Mathf.Max(a, Mathf.Clamp01((0.045f - Mathf.Abs(d - 0.36f)) * 60f)); // 바깥 고리 + a = Mathf.Max(a, Mathf.Clamp01((0.035f - Mathf.Abs(d - 0.25f)) * 60f)); // 안 고리 + a = Mathf.Max(a, Mathf.Clamp01((0.16f - d) * 60f) * 0.85f); // 가운데 점 + return a; + }); + return reticle; + } + } + + static Sprite MakeRadial(int size, System.Func alpha) + { + return MakeRadialXY(size, (x, y) => alpha(Mathf.Sqrt(x * x + y * y))); + } + + /// 가운데 (0,0) · 가장자리 ±1 좌표의 알파 함수로 흰 스프라이트(지름 1)를 만든다. + static Sprite MakeRadialXY(int size, System.Func alpha) + { + var tex = new Texture2D(size, size, TextureFormat.RGBA32, false) { wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Bilinear }; + float half = size * 0.5f; + var px = new Color[size * size]; + for (int y = 0; y < size; y++) + for (int x = 0; x < size; x++) + px[y * size + x] = new Color(1f, 1f, 1f, Mathf.Clamp01(alpha((x + 0.5f - half) / half, (y + 0.5f - half) / half))); + tex.SetPixels(px); + tex.Apply(); + tex.hideFlags = HideFlags.DontSave; + var s = Sprite.Create(tex, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f), size); + s.hideFlags = HideFlags.DontSave; + return s; + } + + /// 위(+y)를 가리키는 둥근 꺾쇠(⌃ 모양 · 128 px · 크기 1) — 사거리 원 위 「공격 가능한 적 방향」 표시(range_style 3). + public static Sprite Chevron + { + get + { + if (chevron != null) return chevron; + const int size = 128; + var tex = new Texture2D(size, size, TextureFormat.RGBA32, false) { wrapMode = TextureWrapMode.Clamp, filterMode = FilterMode.Bilinear }; + var px = new Color[size * size]; + Vector2 tip = new Vector2(0.5f, 0.82f), l = new Vector2(0.12f, 0.3f), r = new Vector2(0.88f, 0.3f); + for (int y = 0; y < size; y++) + for (int x = 0; x < size; x++) + { + var p = new Vector2((x + 0.5f) / size, (y + 0.5f) / size); + float d = Mathf.Min(SegDist(p, l, tip), SegDist(p, r, tip)); + float a = Mathf.Clamp01((0.11f - d) * size * 0.5f); + px[y * size + x] = new Color(1f, 1f, 1f, a); + } + tex.SetPixels(px); + tex.Apply(); + tex.hideFlags = HideFlags.DontSave; + chevron = Sprite.Create(tex, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f), size); + chevron.hideFlags = HideFlags.DontSave; + return chevron; + } + } + + static float SegDist(Vector2 p, Vector2 a, Vector2 b) + { + Vector2 ab = b - a; + float t = Mathf.Clamp01(Vector2.Dot(p - a, ab) / ab.sqrMagnitude); + return Vector2.Distance(p, a + ab * t); + } + + /// 점선 무늬(가로로 반복 · 앞 fill 비율만 흰색 · 끝은 부드럽게) — 선 그리기(LineRenderer Tile)용. + public static Texture2D DashTexture(float fill) + { + if (dashTex != null) return dashTex; + const int w = 64; + dashTex = new Texture2D(w, 4, TextureFormat.RGBA32, false) { wrapMode = TextureWrapMode.Repeat, filterMode = FilterMode.Bilinear }; + var px = new Color[w * 4]; + for (int x = 0; x < w; x++) + { + float u = (x + 0.5f) / w; + float a = Mathf.Clamp01(Mathf.Min(u, fill - u) * w * 0.5f); + for (int y = 0; y < 4; y++) px[y * w + x] = new Color(1f, 1f, 1f, u < fill ? a : 0f); + } + dashTex.SetPixels(px); + dashTex.Apply(); + dashTex.hideFlags = HideFlags.DontSave; + return dashTex; + } + /// 바깥 지름 1 · 안쪽 지름 innerFrac(0~1) 의 채워진 도넛 — 궁병 공격 가능 범위 표시용. public static Sprite Donut(float innerFrac) { diff --git a/Assets/Scripts/Runtime/RangeIndicator.cs b/Assets/Scripts/Runtime/RangeIndicator.cs index 0f4805da..7dcedc8b 100644 --- a/Assets/Scripts/Runtime/RangeIndicator.cs +++ b/Assets/Scripts/Runtime/RangeIndicator.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using UnityEngine; namespace TKS @@ -31,20 +32,21 @@ namespace TKS get { return target; } } + /// 사거리 원(예전 그림 고리 또는 벡터 선)이 보이는가. public bool RingVisible { - get { return ring != null && ring.gameObject.activeSelf; } + get { return (ring != null && ring.gameObject.activeSelf) || VectorVisible; } } public bool SkillRingVisible { - get { return skillRing != null && skillRing.gameObject.activeSelf; } + get { return (skillRing != null && skillRing.gameObject.activeSelf) || (skillVec != null && skillVec.gameObject.activeSelf); } } /// 스킬 범위 원의 지름(월드) = 스킬 반경 × 2(슬링샷 원과 겹치면 조금 큼). public float SkillRingDiameter { - get { return skillRing != null ? skillRing.transform.localScale.x : 0f; } + get { return skillVec != null && skillVec.gameObject.activeSelf ? skillVec.Radius * 2f : skillRing != null ? skillRing.transform.localScale.x : 0f; } } public bool DonutVisible @@ -55,7 +57,7 @@ namespace TKS /// 얇은 원의 지름(월드) = 슬링샷 최대 거리 × 2. public float RingDiameter { - get { return ring != null ? ring.transform.localScale.x : 0f; } + get { return VectorVisible ? radius * 2f : ring != null ? ring.transform.localScale.x : 0f; } } /// 도넛 바깥 지름(월드) = 슬링샷 최대 거리 × (1 + 비율) × 2. @@ -74,6 +76,189 @@ namespace TKS ring.gameObject.SetActive(false); donut.gameObject.SetActive(false); skillRing.gameObject.SetActive(false); + BuildVector(); + } + + // ---------- 벡터 사거리 원(PD 2026-11-23 「해상도가 떨어지는 굵은 베이지색 원형 선 → 개선 · 사정거리 안에 공격 가능한 적이 있을 때 변화」) ---------- + // 선 = LineRenderer(화면 두께가 늘 같음 · 기준 1080×1920 의 px · 크게 늘려도 흐려지지 않음) · 모양 = 표 ib_ui range_style + // 1 = 또렷한 점선 고리 + 아주 옅은 바탕 · 2 = 실선 + 가장자리가 진한 은은한 원판 · 3 = 실선 + 안쪽 눈금 + 공격 가능한 적 방향 꺾쇠 + // 공격 가능 = SlingshotInput.ReachableAtMax(사정거리 안 · 실제 행동과 같은 경로 질의) 가 1 이상 → 선 · 원판 = 공격 색(붉게) + 숨쉬기 + const int Segs = 160; + LineRenderer line; + LineRenderer under; + Material lineMat; + SpriteRenderer disc; + readonly List ticks = new List(); + readonly List chevrons = new List(); + readonly List attackTargets = new List(); + int style; + float radius; + bool attackable; + + /// 캡처 · 시험용 모양 강제(-1 = 표 range_style). + public static int StyleOverride = -1; + + /// 캡처용: 스킬 반경 원을 숨김(스킬 범위 표시 대안 목업의 바탕 화면). + public static bool HideSkillForCapture; + + /// 지금 모양(0 = 예전 그림 고리). + public int Style { get { return style; } } + + /// 사정거리 안에 공격 가능한 적이 있어 공격 색으로 그리는 중인가. + public bool Attackable { get { return attackable; } } + + public bool VectorVisible { get { return line != null && line.gameObject.activeSelf; } } + + void BuildVector() + { + var go = new GameObject("RangeLine"); + go.transform.SetParent(transform, false); + line = go.AddComponent(); + line.useWorldSpace = false; + line.loop = true; + line.positionCount = Segs; + line.numCapVertices = 0; + line.numCornerVertices = 0; + line.alignment = LineAlignment.View; + lineMat = new Material(Shader.Find("Sprites/Default")); + line.sharedMaterial = lineMat; + line.sortingOrder = -8; + // 받침 선(짙은 고동 반투명 · 선보다 조금 두껍게 · 밝은 모래 위에서도 원이 보이게 · QA M5) + var ug = new GameObject("RangeLineUnder"); + ug.transform.SetParent(go.transform, false); + under = ug.AddComponent(); + under.useWorldSpace = false; + under.loop = true; + under.positionCount = Segs; + under.numCapVertices = 0; + under.numCornerVertices = 0; + under.alignment = LineAlignment.View; + under.sharedMaterial = lineMat; + under.sortingOrder = -9; + disc = ProceduralSprites.NewSprite(transform, "RangeDisc", ProceduralSprites.SoftDisc, Color.white, 1f, -11); + go.SetActive(false); + disc.gameObject.SetActive(false); + skillVec = VectorRing.Create(transform, "SkillRangeVec", -7); + skillVec.gameObject.SetActive(false); + } + + VectorRing skillVec; + + SpriteRenderer Pooled(List pool, int i, string name, Sprite sp, int order) + { + while (pool.Count <= i) pool.Add(ProceduralSprites.NewSprite(transform, name + pool.Count, sp, Color.white, 1f, order)); + return pool[i]; + } + + void ShowVector(float r) + { + style = StyleOverride >= 0 ? StyleOverride : Mathf.RoundToInt(IbUi.Num("range_style", 1f)); + radius = r; + bool on = style > 0 && line != null; + if (ring != null) ring.gameObject.SetActive(!on); + if (line == null) return; + line.gameObject.SetActive(on); + disc.gameObject.SetActive(on && (style == 1 || style == 2)); + foreach (var t in ticks) t.gameObject.SetActive(false); + foreach (var c in chevrons) c.gameObject.SetActive(false); + if (!on) return; + for (int i = 0; i < Segs; i++) + { + float a = i * Mathf.PI * 2f / Segs; + line.SetPosition(i, new Vector3(Mathf.Cos(a) * r, Mathf.Sin(a) * r, 0f)); + under.SetPosition(i, new Vector3(Mathf.Cos(a) * r, Mathf.Sin(a) * r, 0f)); + } + bool dashed = style == 1; + line.textureMode = dashed ? LineTextureMode.Tile : LineTextureMode.Stretch; + under.textureMode = line.textureMode; + lineMat.mainTexture = dashed ? ProceduralSprites.DashTexture(IbUi.Num("range_dash_fill", 0.6f)) : null; + disc.transform.localScale = new Vector3(r * 2f, r * 2f, 1f); + if (style == 3) + { + int n = Mathf.Max(0, Mathf.RoundToInt(IbUi.Num("range_tick_count", 36f))); + for (int i = 0; i < n; i++) Pooled(ticks, i, "Tick", ProceduralSprites.Square, -8).gameObject.SetActive(true); + } + UpdateVector(); + } + + /// 사정거리 안 공격 가능한 적(없으면 빈 목록) — 원 색 · 꺾쇠(모양 3)를 바꾼다. + public void SetAttackable(List targets) + { + attackTargets.Clear(); + if (targets != null) attackTargets.AddRange(targets); + attackable = attackTargets.Count > 0; + foreach (var c in chevrons) c.gameObject.SetActive(false); + if (style == 3 && VectorVisible) + for (int i = 0; i < attackTargets.Count; i++) Pooled(chevrons, i, "Chevron", ProceduralSprites.Chevron, -7).gameObject.SetActive(true); + UpdateVector(); + } + + void UpdateVector() + { + if (!VectorVisible) return; + var cam = Camera.main; + float wpp = cam != null && cam.orthographic ? cam.orthographicSize * 2f / 1920f : 0.01f; // 기준 화면(1080×1920) 1 px 의 월드 길이 = UI 와 같이 화면 크기에 맞춰 커짐 + float px = IbUi.Num("range_line_px", style == 1 ? 5f : 4f); + line.widthMultiplier = px * wpp; + if (style == 1) lineMat.mainTextureScale = new Vector2(1f / Mathf.Max(0.001f, IbUi.Num("range_dash_px", 22f) * wpp), 1f); + Color baseC = attackable ? IbUi.Col("range_color_attack", new Color(1f, 0.35f, 0.24f, 0.95f)) : IbUi.Col("range_color", new Color(1f, 0.95f, 0.84f, 0.9f)); + float pulse = 1f; + if (attackable) + { + float period = Mathf.Max(0.1f, IbUi.Num("range_pulse_sec", 1.2f)); + pulse = Mathf.Lerp(IbUi.Num("range_pulse_min", 0.6f), 1f, 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * Mathf.PI * 2f / period)); + } + var lc = new Color(baseC.r, baseC.g, baseC.b, baseC.a * pulse); + line.startColor = line.endColor = lc; + under.widthMultiplier = (px + IbUi.Num("range_under_px", 2f)) * wpp; + var uc = IbUi.Col("range_under_color", new Color(0.23f, 0.14f, 0.08f, 0.35f)); + under.startColor = under.endColor = new Color(uc.r, uc.g, uc.b, uc.a * pulse); + float fa = style == 2 ? IbUi.Num("range_disc_alpha", 0.22f) : IbUi.Num("range_fill_alpha", 0.08f); + if (disc != null) disc.color = new Color(baseC.r, baseC.g, baseC.b, fa * (attackable ? Mathf.Lerp(1f, 1.4f, pulse - 0.6f) : 1f)); + if (style == 3) + { + float tl = IbUi.Num("range_tick_px", 14f) * wpp; + int n = 0; + foreach (var t in ticks) + { + if (!t.gameObject.activeSelf) continue; + n++; + } + for (int i = 0; i < n; i++) + { + float a = i * 360f / n; + var t = ticks[i]; + Vector2 d = new Vector2(Mathf.Cos(a * Mathf.Deg2Rad), Mathf.Sin(a * Mathf.Deg2Rad)); + t.transform.localPosition = d * (radius - tl * 0.5f); + t.transform.localRotation = Quaternion.Euler(0f, 0f, a); + t.transform.localScale = new Vector3(tl, px * 0.75f * wpp, 1f); + t.color = new Color(lc.r, lc.g, lc.b, lc.a * 0.8f); + } + float cs = IbUi.Num("range_chevron_px", 36f) * wpp; + for (int i = 0; i < attackTargets.Count && i < chevrons.Count; i++) + { + var e = attackTargets[i]; + var c = chevrons[i]; + if (e == null || target == null) continue; + Vector2 d = e.Position - target.Position; + if (d.sqrMagnitude < 1e-6f) continue; + d.Normalize(); + c.transform.localPosition = d * (radius + cs * 0.3f); + c.transform.localRotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(d.y, d.x) * Mathf.Rad2Deg - 90f); + c.transform.localScale = new Vector3(cs, cs, 1f); + c.color = new Color(lc.r, lc.g, lc.b, Mathf.Max(0.85f, lc.a)); + } + } + } + + void HideVector() + { + if (line != null) line.gameObject.SetActive(false); + if (disc != null) disc.gameObject.SetActive(false); + foreach (var t in ticks) t.gameObject.SetActive(false); + foreach (var c in chevrons) c.gameObject.SetActive(false); + attackable = false; + attackTargets.Clear(); } public void Show(Unit u) @@ -99,13 +284,24 @@ namespace TKS if (donut.gameObject.activeSelf != reach) donut.gameObject.SetActive(reach); float rs = SkillSystem.Current != null ? SkillSystem.Current.ActiveRadius(u) : 0f; - bool hasSkill = rs > 0.01f; + bool hasSkill = rs > 0.01f && !HideSkillForCapture && SkillIndicatorTable.On("radius", true); // 표 skill_indicator.csv radius 줄(원형 · PD 2026-11-24) if (hasSkill) { if (Mathf.Abs(rs - r) < SkillRingGap) rs = r + SkillRingGap; // 두 원이 겹치면 한 줄로 보임 → 스킬 원을 바깥으로 skillRing.transform.localScale = new Vector3(rs * 2f, rs * 2f, 1f); } if (skillRing.gameObject.activeSelf != hasSkill) skillRing.gameObject.SetActive(hasSkill); + // 스킬 반경 = 벡터 금 실선 + 은은한 금 원판(PD 2026-11-23 「스킬 시전 범위도 수정」 · 사거리 원과 같은 방식 · 표 skill_range_*) + bool vec = skillVec != null && (StyleOverride >= 0 ? StyleOverride : Mathf.RoundToInt(IbUi.Num("range_style", 1f))) > 0; + if (vec && hasSkill) + { + skillRing.gameObject.SetActive(false); + skillVec.UseSkillStyle(IbUi.Num("skill_range_disc_alpha", 0.1f)); // 공격 인디케이터(PD 2026-11-24 예시) 또는 실선 + 원판 + skillVec.SetRadius(rs); + } + if (skillVec != null && skillVec.gameObject.activeSelf != (vec && hasSkill)) skillVec.gameObject.SetActive(vec && hasSkill); + HideVector(); + ShowVector(r); // 표 range_style ≥ 1 = 벡터 선(예전 그림 고리는 숨김) Follow(); } @@ -115,6 +311,8 @@ namespace TKS if (ring != null) ring.gameObject.SetActive(false); if (donut != null) donut.gameObject.SetActive(false); if (skillRing != null) skillRing.gameObject.SetActive(false); + if (skillVec != null) skillVec.gameObject.SetActive(false); + HideVector(); } /// 궁병 도넛 색: 공격 가능 범위 안에 적이 있으면 붉게, 없으면 회색. @@ -132,6 +330,7 @@ namespace TKS return; } Follow(); + UpdateVector(); // 카메라 확대 · 숨쉬기 · 꺾쇠 방향 } void Follow() diff --git a/Assets/Scripts/Runtime/SkillShapeIndicator.cs b/Assets/Scripts/Runtime/SkillShapeIndicator.cs new file mode 100644 index 00000000..2dbc5ced --- /dev/null +++ b/Assets/Scripts/Runtime/SkillShapeIndicator.cs @@ -0,0 +1,442 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace TKS +{ + /// + /// 스킬 범위 모양 표(Resources/Skills/skill_indicator.csv · C45 · PD 2026-11-24 「스킬 범위까지 게임에 모두 반영」) — + /// 효과 키(shot_laser · shot_fan …) 또는 범위 종류(radius · point) → 모양(circle · sector · line · none) · 켜기(on). + /// + public static class SkillIndicatorTable + { + public const string TablePath = "Skills/skill_indicator"; + static Dictionary shapes; + static Dictionary ons; + + public static void Reload() + { + shapes = null; + ons = null; + } + + static void Ensure() + { + if (shapes != null) return; + shapes = new Dictionary(); + ons = new Dictionary(); + var ta = Resources.Load(TablePath); + if (ta == null) return; + bool head = true; + foreach (var raw in ta.text.Replace("\r", "").Split('\n')) + { + var line = raw.TrimStart(''); + if (line.Trim().Length == 0 || line.TrimStart().StartsWith("#")) continue; + if (head) + { + head = false; + continue; + } + var c = SkillVfx.SplitCsv(line); + if (c.Length < 3) continue; + string key = c[0].Trim(); + shapes[key] = c[1].Trim().ToLowerInvariant(); + ons[key] = c[2].Trim() != "0"; + } + } + + /// 모양(circle · sector · line · none) · 줄이 없으면 def. + public static string Shape(string key, string def) + { + Ensure(); + string v; + return key != null && shapes.TryGetValue(key, out v) && v.Length > 0 ? v : def; + } + + /// 켜기(줄이 없으면 def). + public static bool On(string key, bool def) + { + Ensure(); + bool v; + return key != null && ons.TryGetValue(key, out v) ? v : def; + } + } + + /// + /// 조준 중 스킬 범위 표시(PD 2026-11-24) — 직선(끝에 화살촉 · 양옆 두 줄 · 끝으로 갈수록 옅어지는 띠 · PD 예시) · 부채꼴 · 원(공격 인디케이터 = VectorRing). + /// 모든 부품 = 유닛(정렬 0)보다 아래 층(표 ib_ui skill_shape_order · PD 「레이어를 영웅보다 하단」 = 부채꼴 · 직선이 시작하는 점이 쓰는 영웅 그림에 가려짐) · + /// 선 두께 = 기준 화면(1080×1920) px(화면 크기에 맞춰 커짐) · 색 · 알파 · 크기 = 표 ib_ui skill_line_* · skill_sector_*. + /// 모양 · 길이 · 폭 = ActionResolver.SkillAim(실제 사격과 같은 궤적 질의) · 어떤 모양으로 그릴지 = 표 skill_indicator.csv. + /// + public class SkillShapeIndicator : MonoBehaviour + { + public enum Kind { None, Circle, Sector, Line } + + const int ArcSegs = 48; + const int BandSegs = 16; + + Mesh fillMesh; + MeshRenderer fillR; + LineRenderer outline; + LineRenderer outlineUnder; + LineRenderer sideL; + LineRenderer sideR; + LineRenderer sideLU; + LineRenderer sideRU; + LineRenderer innerArc; + SpriteRenderer dot; + VectorRing ring; + Material mat; + + Kind kind; + ActionResolver.SkillAimShape shape; + readonly List verts = new List(); + readonly List cols = new List(); + readonly List tris = new List(); + + /// 지금 그리는 모양(None = 숨김). + public Kind Current { get { return gameObject.activeSelf ? kind : Kind.None; } } + + /// 지금 그리는 범위(효과 키 · 시작점 · 길이 · 폭 · 각 · 원). + public ActionResolver.SkillAimShape Shape { get { return shape; } } + + /// 부품 정렬 값 중 가장 높은 것(시험 · 유닛 0 보다 작아야 함). + public int TopOrder { get { return outline != null ? outline.sortingOrder : 0; } } + + public static SkillShapeIndicator Create(Transform parent, string name) + { + var go = new GameObject(name); + go.transform.SetParent(parent, false); + var si = go.AddComponent(); + si.Build(); + go.SetActive(false); + return si; + } + + void Build() + { + int top = Mathf.Min(-1, Mathf.RoundToInt(IbUi.Num("skill_shape_order", -6f))); // 유닛(0) 아래 · 사거리 원(−8 ~ −11) 위 + mat = new Material(Shader.Find("Sprites/Default")); + var fgo = new GameObject("Fill"); + fgo.transform.SetParent(transform, false); + fillMesh = new Mesh { name = "SkillShapeFill" }; + fillMesh.MarkDynamic(); + fgo.AddComponent().sharedMesh = fillMesh; + fillR = fgo.AddComponent(); + fillR.sharedMaterial = mat; + fillR.sortingOrder = top - 2; + outlineUnder = NewLine("OutlineUnder", top - 1, true); + outline = NewLine("Outline", top, true); + sideLU = NewLine("SideLUnder", top - 1, false); + sideRU = NewLine("SideRUnder", top - 1, false); + sideL = NewLine("SideL", top, false); + sideR = NewLine("SideR", top, false); + innerArc = NewLine("InnerArc", top, false); + dot = ProceduralSprites.NewSprite(transform, "Dot", ProceduralSprites.RadialGlow, Color.white, 1f, top - 3); + ring = VectorRing.Create(transform, "Ring", top); + ring.gameObject.SetActive(false); + } + + LineRenderer NewLine(string name, int order, bool loop) + { + var g = new GameObject(name); + g.transform.SetParent(transform, false); + var lr = g.AddComponent(); + lr.useWorldSpace = true; + lr.loop = loop; + lr.numCapVertices = 0; + lr.numCornerVertices = 2; + lr.alignment = LineAlignment.View; + lr.sharedMaterial = mat; + lr.sortingOrder = order; + return lr; + } + + /// 표(skill_indicator.csv)가 정한 모양으로 그린다 · 줄이 없거나 꺼져 있으면 숨김. + public void Show(ActionResolver.SkillAimShape s) + { + string sh = SkillIndicatorTable.On(s.Key, true) ? SkillIndicatorTable.Shape(s.Key, "none") : "none"; + Kind k = sh == "line" ? Kind.Line : sh == "sector" ? Kind.Sector : sh == "circle" ? Kind.Circle : Kind.None; + if (k == Kind.None) + { + Hide(); + return; + } + shape = s; + kind = k; + if (k != Kind.Line) DrawnLength = 0f; + if (!gameObject.activeSelf) gameObject.SetActive(true); + bool lineParts = k == Kind.Line; + bool sectorParts = k == Kind.Sector; + fillR.gameObject.SetActive(lineParts || sectorParts); + outline.gameObject.SetActive(lineParts || sectorParts); + outlineUnder.gameObject.SetActive(lineParts || sectorParts); + sideL.gameObject.SetActive(lineParts); + sideR.gameObject.SetActive(lineParts); + sideLU.gameObject.SetActive(lineParts); + sideRU.gameObject.SetActive(lineParts); + innerArc.gameObject.SetActive(sectorParts); + dot.gameObject.SetActive(sectorParts && IbUi.Num("skill_sector_dot_px", 0f) > 0.5f); + if (k == Kind.Circle) + { + Vector2 c = s.Radius > 0f ? s.Center : s.From + s.Dir * s.Length; + float r = s.Radius > 0f ? s.Radius : Mathf.Max(s.HalfWidth, 0.5f); + ring.transform.position = new Vector3(c.x, c.y, 0f); + if (!ring.gameObject.activeSelf || Mathf.Abs(ring.Radius - r) > 1e-4f) + { + ring.gameObject.SetActive(true); + ring.UseSkillStyle(IbUi.Num("skill_area_disc_alpha", 0.16f)); + ring.SetRadius(r); + } + } + else if (ring.gameObject.activeSelf) ring.gameObject.SetActive(false); + Redraw(); + } + + public void Hide() + { + kind = Kind.None; + if (gameObject.activeSelf) gameObject.SetActive(false); + } + + void LateUpdate() + { + if (kind == Kind.Line || kind == Kind.Sector) Redraw(); // 카메라 확대(선 두께) · 숨쉬기 + } + + static float Wpp() + { + var cam = Camera.main; + return cam != null && cam.orthographic ? cam.orthographicSize * 2f / 1920f : 0.01f; // 기준 화면 1 px 의 월드 길이 + } + + float Pulse() + { + float sec = Mathf.Max(0.1f, IbUi.Num("skill_ind_pulse_sec", 1.4f)); + return 0.8f + 0.2f * Mathf.Sin(Time.unscaledTime * Mathf.PI * 2f / sec); + } + + static Color A(Color c, float a) + { + return new Color(c.r, c.g, c.b, Mathf.Clamp01(a)); + } + + /// 줄 색: 꼬리(0) = tailA → fadeFrac 지점부터 headA(꼬리 쪽만 옅어짐). + static void SetFade(LineRenderer lr, Color c, float tailA, float headA, float fadeFrac) + { + float f = Mathf.Clamp(fadeFrac, 0.02f, 0.98f); + var g = new Gradient(); + g.SetKeys(new[] { new GradientColorKey(c, 0f), new GradientColorKey(c, 1f) }, + new[] { new GradientAlphaKey(tailA, 0f), new GradientAlphaKey(Mathf.Lerp(tailA, headA, 0.6f), f * 0.5f), new GradientAlphaKey(headA, f), new GradientAlphaKey(headA, 1f) }); + lr.colorGradient = g; + } + + /// 지금 그린 직선 길이(보이는 전장 안으로 줄인 값 · 시험 · 캡처 기록). + public float DrawnLength { get; private set; } + + /// + /// 화살촉이 위 탑바 · 아래 정보판 밑에 숨지 않게 그리는 길이를 보이는 전장(카메라 시야 − 표 skill_line_view_*_px)까지로 줄인다 + /// (레이저 = 화면 끝까지라 화살촉이 탑바 밑에 묻혔음 · 2026-11-24 1배 캡처 실측) · 쏘는 자리가 그 밖이면 그대로. + /// + static float VisibleLength(Vector2 o, Vector2 d, float L, float wpp) + { + var cam = Camera.main; + if (cam == null || !cam.orthographic) return L; + float halfH = cam.orthographicSize, halfW = halfH * cam.aspect; + Vector2 c = cam.transform.position; + float top = c.y + halfH - IbUi.Num("skill_line_view_top_px", 250f) * wpp; + float bottom = c.y - halfH + IbUi.Num("skill_line_view_bottom_px", 380f) * wpp; + float side = IbUi.Num("skill_line_view_side_px", 24f) * wpp; + float left = c.x - halfW + side, right = c.x + halfW - side; + if (o.x < left || o.x > right || o.y < bottom || o.y > top) return L; + float t = L; + if (d.x > 1e-6f) t = Mathf.Min(t, (right - o.x) / d.x); + else if (d.x < -1e-6f) t = Mathf.Min(t, (left - o.x) / d.x); + if (d.y > 1e-6f) t = Mathf.Min(t, (top - o.y) / d.y); + else if (d.y < -1e-6f) t = Mathf.Min(t, (bottom - o.y) / d.y); + return Mathf.Max(0.01f, t); + } + + void Redraw() + { + if (kind == Kind.Line) DrawLine(); + else if (kind == Kind.Sector) DrawSector(); + } + + // ---------- 직선(PD 예시 = 끝에 화살촉 · 양옆 두 줄 · 끝으로 갈수록 옅어지는 띠 · 원형 인디케이터와 같은 청록) ---------- + void DrawLine() + { + float wpp = Wpp(); + float pulse = Pulse(); + Color col = IbUi.Col("skill_line_color", new Color(0.25f, 0.85f, 1f, 1f)); + Color under = IbUi.Col("skill_line_under_color", new Color(0.04f, 0.23f, 0.29f, 0.55f)); + float lw = IbUi.Num("skill_line_px", 5f) * wpp; + float uw = lw + IbUi.Num("range_under_px", 2f) * wpp; + float headA = IbUi.Num("skill_line_alpha_head", 1f) * pulse; + float tailA = IbUi.Num("skill_line_alpha_tail", 0f); + float fillHead = IbUi.Num("skill_line_fill_head", 0.45f) * pulse; + float fillTail = IbUi.Num("skill_line_fill_tail", 0f); + float centerMul = IbUi.Num("skill_line_fill_center", 0.55f); + Color fillCol = IbUi.Col("skill_line_fill_color", new Color(0.59f, 0.92f, 0.96f, 1f)); // 띠 속 = 밝은 청록(모래 위에서 탁한 회갈색이 되지 않게 · QA r1 M2) + + Vector2 o = shape.From, d = shape.Dir.sqrMagnitude > 1e-6f ? shape.Dir.normalized : Vector2.up; + Vector2 p = new Vector2(-d.y, d.x); + float L = VisibleLength(o, d, Mathf.Max(0.01f, shape.Length), wpp); + DrawnLength = L; + float hw = Mathf.Max(shape.HalfWidth, IbUi.Num("skill_line_min_half_px", 18f) * wpp); + float headLen = Mathf.Min(L * 0.45f, Mathf.Max(hw * IbUi.Num("skill_line_head_len", 1.3f), IbUi.Num("skill_line_head_min_px", 40f) * wpp)); + float headHalf = hw * IbUi.Num("skill_line_head_width", 1.6f); + float bandEnd = L - headLen; + // 띠 = 화살촉 쪽 진함 → 쏘는 영웅 쪽으로 길이 따라 옅어짐(QA r1 B1 · PD 예시) · 양옆 줄 = 영웅 쪽 끝부분만 옅어짐 + float fadeLen = Mathf.Max(0.01f, bandEnd * Mathf.Clamp(IbUi.Num("skill_line_fade_frac", 1f), 0.05f, 1f)); + float fadeFrac = Mathf.Clamp(IbUi.Num("skill_line_side_fade_frac", 0.45f), 0.02f, 0.98f); + float bw = hw * Mathf.Clamp(IbUi.Num("skill_line_band_frac", 0.7f), 0.1f, 1f); // 띠 반폭 < 줄 간격 = 띠와 양옆 줄 사이 틈(QA r1 M5 · PD 예시 세 줄 구조) + System.Func W = (along, side) => { var v = o + d * along + p * side; return new Vector3(v.x, v.y, 0f); }; + + // 띠(가로 = 가장자리 진하고 가운데 옅게) + verts.Clear(); + cols.Clear(); + tris.Clear(); + for (int i = 0; i <= BandSegs; i++) + { + float s = bandEnd * i / BandSegs; + float a = Mathf.Lerp(fillHead, fillTail, Mathf.Clamp01((bandEnd - s) / fadeLen)); // 화살촉 쪽(s = bandEnd) = fillHead · 영웅 쪽 = fillTail + verts.Add(W(s, -bw)); + verts.Add(W(s, 0f)); + verts.Add(W(s, bw)); + cols.Add(A(fillCol, a)); + cols.Add(A(fillCol, a * centerMul)); + cols.Add(A(fillCol, a)); + if (i == 0) continue; + int b = (i - 1) * 3; + for (int k = 0; k < 2; k++) + { + int q = b + k; + tris.Add(q); tris.Add(q + 3); tris.Add(q + 4); + tris.Add(q); tris.Add(q + 4); tris.Add(q + 1); + } + } + // 화살촉 채움 + int h0 = verts.Count; + verts.Add(W(bandEnd, -headHalf)); + verts.Add(W(L, 0f)); + verts.Add(W(bandEnd, headHalf)); + float ha = IbUi.Num("skill_line_head_fill", 0.45f) * pulse; + cols.Add(A(fillCol, ha)); + cols.Add(A(fillCol, ha * 1.2f)); + cols.Add(A(fillCol, ha)); + tris.Add(h0); tris.Add(h0 + 1); tris.Add(h0 + 2); + ApplyMesh(); + + // 양옆 두 줄(꼬리에서 옅어짐) + 짙은 받침 선 + sideL.positionCount = sideR.positionCount = sideLU.positionCount = sideRU.positionCount = 2; + sideL.SetPosition(0, W(0f, -hw)); sideL.SetPosition(1, W(bandEnd, -hw)); + sideR.SetPosition(0, W(0f, hw)); sideR.SetPosition(1, W(bandEnd, hw)); + sideLU.SetPosition(0, W(0f, -hw)); sideLU.SetPosition(1, W(bandEnd, -hw)); + sideRU.SetPosition(0, W(0f, hw)); sideRU.SetPosition(1, W(bandEnd, hw)); + sideL.widthMultiplier = sideR.widthMultiplier = lw; + sideLU.widthMultiplier = sideRU.widthMultiplier = uw; + SetFade(sideL, col, tailA, headA, fadeFrac); + SetFade(sideR, col, tailA, headA, fadeFrac); + SetFade(sideLU, under, tailA * under.a, under.a, fadeFrac); + SetFade(sideRU, under, tailA * under.a, under.a, fadeFrac); + + // 화살촉 테두리(밑변 포함 닫힌 세모) + outline.positionCount = outlineUnder.positionCount = 3; + outline.SetPosition(0, W(bandEnd, -headHalf)); outline.SetPosition(1, W(L, 0f)); outline.SetPosition(2, W(bandEnd, headHalf)); + outlineUnder.SetPosition(0, W(bandEnd, -headHalf)); outlineUnder.SetPosition(1, W(L, 0f)); outlineUnder.SetPosition(2, W(bandEnd, headHalf)); + outline.widthMultiplier = lw; + outlineUnder.widthMultiplier = uw; + outline.colorGradient = Solid(A(col, headA)); + outlineUnder.colorGradient = Solid(under); + } + + // ---------- 부채꼴(PD 예시 = 붉은 부채꼴 · 원형 인디케이터와 같은 결 = 가장자리가 진한 바닥 빛 + 안쪽 호 + 숨쉬기 · 중심점 = 영웅 그림 밑) ---------- + void DrawSector() + { + float wpp = Wpp(); + float pulse = Pulse(); + Color col = IbUi.Col("skill_sector_color", new Color(1f, 0.35f, 0.24f, 1f)); + Color under = IbUi.Col("skill_sector_under_color", new Color(0.29f, 0.06f, 0.04f, 0.55f)); + float lw = IbUi.Num("skill_sector_line_px", 6f) * wpp; + float uw = lw + IbUi.Num("range_under_px", 2f) * wpp; + float edgeA = IbUi.Num("skill_sector_fill_edge", 0.38f) * pulse; + float midA = IbUi.Num("skill_sector_fill_mid", 0.1f); + float centerA = IbUi.Num("skill_sector_fill_center", 0.04f); + float glowFrac = Mathf.Clamp(IbUi.Num("skill_sector_glow_frac", 0.3f), 0.05f, 0.95f); + float innerFrac = IbUi.Num("skill_ind_inner", 0.8f); + + Vector2 o = shape.From, d = shape.Dir.sqrMagnitude > 1e-6f ? shape.Dir.normalized : Vector2.up; + float R = Mathf.Max(0.05f, shape.Length); + float ang = shape.Angle > 0.1f ? shape.Angle : IbUi.Num("skill_sector_default_angle", 60f); + ang = Mathf.Clamp(ang, 1f, 359f); + float a0 = Mathf.Atan2(d.y, d.x) - ang * 0.5f * Mathf.Deg2Rad; + float step = ang * Mathf.Deg2Rad / ArcSegs; + System.Func P = (i, r) => { float a = a0 + step * i; return new Vector3(o.x + Mathf.Cos(a) * r, o.y + Mathf.Sin(a) * r, 0f); }; + + verts.Clear(); + cols.Clear(); + tris.Clear(); + verts.Add(new Vector3(o.x, o.y, 0f)); + cols.Add(A(col, centerA)); + for (int i = 0; i <= ArcSegs; i++) + { + verts.Add(P(i, R * (1f - glowFrac))); + verts.Add(P(i, R)); + cols.Add(A(col, midA)); + cols.Add(A(col, edgeA)); + if (i == 0) continue; + int b = 1 + (i - 1) * 2; + tris.Add(0); tris.Add(b + 2); tris.Add(b); + tris.Add(b); tris.Add(b + 2); tris.Add(b + 3); + tris.Add(b); tris.Add(b + 3); tris.Add(b + 1); + } + ApplyMesh(); + + // 테두리 = 중심 → 호 → 중심(닫힘) + outline.positionCount = outlineUnder.positionCount = ArcSegs + 2; + outline.SetPosition(0, new Vector3(o.x, o.y, 0f)); + outlineUnder.SetPosition(0, new Vector3(o.x, o.y, 0f)); + for (int i = 0; i <= ArcSegs; i++) + { + outline.SetPosition(i + 1, P(i, R)); + outlineUnder.SetPosition(i + 1, P(i, R)); + } + outline.widthMultiplier = lw; + outlineUnder.widthMultiplier = uw; + outline.colorGradient = Solid(A(col, col.a * Mathf.Lerp(0.85f, 1f, pulse))); + outlineUnder.colorGradient = Solid(under); + + // 안쪽 호(원형 인디케이터의 안쪽 고리와 같은 자리 · 가늘게) + innerArc.positionCount = ArcSegs + 1; + for (int i = 0; i <= ArcSegs; i++) innerArc.SetPosition(i, P(i, R * innerFrac)); + innerArc.widthMultiplier = Mathf.Max(1.5f, IbUi.Num("skill_sector_line_px", 6f) * 0.45f) * wpp; + innerArc.colorGradient = Solid(A(col, col.a * 0.7f)); + + float dp = IbUi.Num("skill_sector_dot_px", 0f) * wpp; + if (dot.gameObject.activeSelf) + { + dot.transform.position = new Vector3(o.x, o.y, 0f); + dot.transform.localScale = new Vector3(dp, dp * 0.6f, 1f); + dot.color = A(col, 0.9f); + } + } + + static Gradient Solid(Color c) + { + var g = new Gradient(); + g.SetKeys(new[] { new GradientColorKey(c, 0f), new GradientColorKey(c, 1f) }, new[] { new GradientAlphaKey(c.a, 0f), new GradientAlphaKey(c.a, 1f) }); + return g; + } + + void ApplyMesh() + { + var t = fillR.transform; // 정점은 월드 좌표로 셈 → 채움 물체 기준으로 바꿈(부모 위치 · 크기와 무관) + for (int i = 0; i < verts.Count; i++) verts[i] = t.InverseTransformPoint(verts[i]); + fillMesh.Clear(); + fillMesh.SetVertices(verts); + fillMesh.SetColors(cols); + fillMesh.SetTriangles(tris, 0); + fillMesh.RecalculateBounds(); + } + } +} diff --git a/Assets/Scripts/Runtime/SkillShapeIndicator.cs.meta b/Assets/Scripts/Runtime/SkillShapeIndicator.cs.meta new file mode 100644 index 00000000..501d78fa --- /dev/null +++ b/Assets/Scripts/Runtime/SkillShapeIndicator.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6fa189603245d2447b2aa02c6cc19fb9 \ No newline at end of file diff --git a/Assets/Scripts/Runtime/SlingshotInput.cs b/Assets/Scripts/Runtime/SlingshotInput.cs index 5c7845c2..5a57d7f0 100644 --- a/Assets/Scripts/Runtime/SlingshotInput.cs +++ b/Assets/Scripts/Runtime/SlingshotInput.cs @@ -179,17 +179,101 @@ namespace TKS Unit tipTarget; - /// 화살표 끝 규칙의 조준 표시: 조준점이 적에 닿아 사격이 나가면 화살표 = 공격 색 + 그 적 강조 · 닿지 않으면 진영 색(이동). + /// + /// 조준 표시: 지금 조준으로 공격이 나가면 화살표 = 공격 색(붉게) + 맞을 적 강조 · 아니면 진영 색(이동). + /// 원거리 = 화살표 끝 규칙(TipShoots) · 근접 · 기병(PD 2026-11-23 「근접 유닛도 공격 가능한 경우 화살표가 붉은 색」) = 실제 행동과 같은 경로 질의(PredictTargets · 정지점 · 벽 · 아군 막힘 반영). + /// void ShowTip(Unit u, Vector2 target) { - if (!AimRules.RangedTip || u == null || !UnitTypeInfo.IsRanged(u.Type)) return; - Unit t; - bool shoot = battle.Resolver.TipShoots(u, target, out t); - if (ibArrow != null) ibArrow.SetAttack(shoot); - if (t == tipTarget) return; + if (u == null) return; + if (AimRules.RangedTip && UnitTypeInfo.IsRanged(u.Type)) + { + Unit t; + bool shoot = battle.Resolver.TipShoots(u, target, out t); + if (ibArrow != null) ibArrow.SetAttack(shoot); + if (t == tipTarget) return; + ClearHighlights(); + tipTarget = t; + if (t != null) Highlight(t, t.Faction == u.Faction); + return; + } + if (UnitTypeInfo.IsRanged(u.Type)) return; // 화살표 끝 규칙이 꺼진 원거리 = 판정 막대 규칙 그대로 + var hits = battle.Resolver.PredictTargets(u, target, u.BonusMoveAvailable); + if (ibArrow != null) ibArrow.SetAttack(hits.Count > 0); + Unit first = hits.Count > 0 ? hits[0] : null; + if (first == tipTarget && highlighted.Count == hits.Count) return; ClearHighlights(); - tipTarget = t; - if (t != null) Highlight(t, t.Faction == u.Faction); + tipTarget = first; + foreach (var e in hits) Highlight(e, false); + } + + /// + /// 선택한 영웅이 최대 파워로 곧장 쏘면 공격이 닿는 적(PD 2026-11-23 「최대 파워일 때 적을 공격할 수 있는지 아닌지 정확하게 인지」) — + /// 적마다 그 적 쪽으로 최대 조준(AimMax)을 넣어 실제 행동과 같은 질의(원거리 = TipShoots · 근접 · 기병 = PredictTargets)로 맞는 적을 모은다. + /// 이동만 남은 유닛(추가 이동)은 없음. + /// + public List ReachableAtMax(Unit u) + { + var result = new List(); + if (u == null || battle == null || u.BonusMoveAvailable) return result; + float max = AimMax(u); + Faction other = u.Faction == Faction.Player ? Faction.Enemy : Faction.Player; + foreach (var e in battle.AliveUnits(other)) + { + Vector2 d = e.Position - u.Position; + if (d.sqrMagnitude < 1e-6f) continue; + if (AimRules.RangedTip && UnitTypeInfo.IsRanged(u.Type)) + { + Unit t; + if (battle.Resolver.TipShoots(u, u.Position + d.normalized * Mathf.Min(max, d.magnitude), out t) && t != null && t.Faction != u.Faction && !result.Contains(t)) result.Add(t); + continue; + } + foreach (var h in battle.Resolver.PredictTargets(u, u.Position + d.normalized * max, false)) + if (!result.Contains(h)) result.Add(h); + } + return result; + } + + /// 캡처 · 시험용: 손 조작과 같은 조준 표시(고리 · 화살표 · 공격 색 · 맞을 적 강조)를 target 으로 띄운다. + public void ShowAimForCapture(Unit u, Vector2 target) + { + if (u == null) return; + if (ibArrow != null) ibArrow.Begin(u); + ClearHighlights(); + tipTarget = null; + ShowTip(u, target); + ShowAim(u, target); + if (u.View != null) u.View.SetAiming(true); // 손 조작과 같이 조작하는 영웅을 화살표 위로(PD 2026-11-24) + captureAimUnit = u; + } + + Unit captureAimUnit; + + /// 캡처 · 시험용: 조준 표시를 거둔다. + public void HideAimForCapture() + { + HidePreview(); + EndArrow(); + if (captureAimUnit != null && captureAimUnit.View != null) captureAimUnit.View.SetAiming(false); + captureAimUnit = null; + } + + /// 시험용: 지금 화살표가 공격 색인가. + public bool AimShowsAttack { get { return ibArrow != null && ibArrow.AttackShown; } } + + /// 선택 표시: 최대 파워로 공격이 닿는 적에 강조 고리(조준을 시작하면 조준 표시로 바뀜 · 조준을 거두면 다시). + void ShowReach(Unit u) + { + ClearHighlights(); + tipTarget = null; + if (u == null || u.Faction != Faction.Player || !battle.CanAct(u)) + { + if (range != null) range.SetAttackable(null); + return; + } + var reach = ReachableAtMax(u); + foreach (var e in reach) Highlight(e, false); + if (range != null) range.SetAttackable(reach); // 사정거리 안에 공격 가능한 적이 있으면 사거리 원 = 공격 색 + 숨쉬기(PD 2026-11-23 2차) } /// 끌기 조준의 치명타 게이지(0~1): 바닥 ↔ 끝을 표 crit_sweep_sec 초에 한 번씩 오르내림 · 게이지 시간 % 스킬(gauge_time_pct)은 같은 비율로 늦춘다. @@ -292,6 +376,11 @@ namespace TKS splashArea.gameObject.SetActive(false); teleportArea = ProceduralSprites.NewSprite(transform, "TeleportArea", ProceduralSprites.Circle, new Color(1f, 0.85f, 0.3f, 0.18f), 1f, -8); teleportArea.gameObject.SetActive(false); + // 스킬 지점 선택 반경 = 벡터 금 실선 + 은은한 원판(PD 2026-11-23 「스킬 시전 범위도 수정」 · 딱딱한 노란 원판 대신 · 표 ib_ui skill_range_*) + teleportVec = VectorRing.Create(transform, "TeleportAreaVec", -7); + teleportVec.gameObject.SetActive(false); + // 조준 중 스킬 범위(직선 · 부채꼴 · 떨어질 자리 원 · PD 2026-11-24 · 유닛 아래 층 · 표 skill_indicator.csv) + skillShape = SkillShapeIndicator.Create(transform, "SkillShape"); var rgo = new GameObject("RangeIndicator"); rgo.transform.SetParent(transform, false); @@ -504,7 +593,7 @@ namespace TKS } else if (demoArrow) { - if (ibArrow != null) ibArrow.End(); + EndArrow(); demoArrow = false; } DrawGauge(u, on && (AimRules.DragMode || SkillMods.GaugeCycle(u) > 0f)); @@ -512,7 +601,7 @@ namespace TKS void EndDemo() { - if (ibArrow != null) ibArrow.End(); + EndArrow(); if (gaugeRoot != null) gaugeRoot.gameObject.SetActive(false); demoUnit = null; demoArrow = false; @@ -523,7 +612,7 @@ namespace TKS void CancelAim() { HidePreview(); - if (ibArrow != null) ibArrow.End(); + EndArrow(); if (marks != null) marks.HideBubbles(); if (matchup != null) matchup.Hide(); if (selected != null && selected.View != null) selected.View.SetAiming(false); @@ -536,25 +625,40 @@ namespace TKS { var sys = battle.Skills; var u = sys != null ? sys.PendingUnit : null; - bool on = u != null && u.IsAlive && sys.PendingRadius > 0f; // 변진 목표 · 맹장 복귀 지점(조조 방향 탭 = 반경 없음) + bool on = u != null && u.IsAlive && sys.PendingRadius > 0f && SkillIndicatorTable.On("point", true); // 변진 목표 · 맹장 복귀 지점(조조 방향 탭 = 반경 없음) · 표 skill_indicator.csv point 줄 + bool vec = teleportVec != null && (RangeIndicator.StyleOverride >= 0 ? RangeIndicator.StyleOverride : Mathf.RoundToInt(IbUi.Num("range_style", 1f))) > 0; if (on) { float d = sys.PendingRadius * 2f; Vector2 c = sys.PendingKind == SkillSystem.TapKind.Teleport ? u.Position : sys.PendingCenter; teleportArea.transform.position = new Vector3(c.x, c.y, 0f); teleportArea.transform.localScale = new Vector3(d, d, 1f); + if (vec) + { + teleportVec.transform.position = new Vector3(c.x, c.y, 0f); + if (Mathf.Abs(teleportVec.Radius - sys.PendingRadius) > 1e-4f || !teleportVec.gameObject.activeSelf) + { + teleportVec.UseSkillStyle(IbUi.Num("skill_area_disc_alpha", 0.16f)); // 공격 인디케이터(PD 2026-11-24 예시) 또는 실선 + 원판 + teleportVec.SetRadius(sys.PendingRadius); + } + } } - if (teleportArea.gameObject.activeSelf != on) teleportArea.gameObject.SetActive(on); + bool spriteOn = on && !vec; + if (teleportArea.gameObject.activeSelf != spriteOn) teleportArea.gameObject.SetActive(spriteOn); + if (teleportVec != null && teleportVec.gameObject.activeSelf != (on && vec)) teleportVec.gameObject.SetActive(on && vec); } + VectorRing teleportVec; + public bool TeleportAreaVisible { - get { return teleportArea != null && teleportArea.gameObject.activeSelf; } + get { return (teleportArea != null && teleportArea.gameObject.activeSelf) || (teleportVec != null && teleportVec.gameObject.activeSelf); } } void OnPress(Vector2 screen) { IbUi.Reload(); // 표 ib_ui.csv 다시 읽기(이 프로젝트는 Play 때 도메인 리로드를 끔 → 표만 고치면 예전 값이 남던 것 · 2026-11-18) + SkillIndicatorTable.Reload(); // 스킬 범위 모양 표(skill_indicator.csv)도 같은 까닭 AimRules.Refresh(); // 조준 방식(표 aim_mode · 테스트 메뉴) 다시 읽기 lastScreen = screen; pressScreen = screen; @@ -653,6 +757,7 @@ namespace TKS { HidePreview(); if (ibArrow != null) ibArrow.Aim(selected, Vector2.zero, 0f); // 고리만 남김 + ShowReach(selected); // 조준을 거둠 = 선택 표시(최대 파워로 닿는 적)로 되돌림 } previewValid = false; PullZoom(0f); @@ -661,6 +766,8 @@ namespace TKS if (!was) { aimStart = Time.unscaledTime; // 화살표가 뜨는 순간부터 게이지가 차오른다 + ClearHighlights(); // 선택 표시(최대 파워로 닿는 적)를 거두고 조준 표시로 + tipTarget = null; SoundHooks.AimStart(); // 소리: 조준 시작 bt_aim(2026-11-20 사운드) if (AimRules.DragMode) RollZones(selected); // 끌기 조준 = 조준할 때마다 판정 칸 새로 } @@ -681,8 +788,8 @@ namespace TKS previewValid = true; Sound.Rise(SoundKeys.BtGaugeCrit, GaugeCritNow(selected)); // 소리: 게이지가 치명타 구간에 들어서는 순간(2026-11-20 사운드) if (selected.View != null) selected.View.SetFacing(currentTarget - selected.Position); // 조준하는 동안 쏠 방향을 봄(PD 2026-11-11) + ShowTip(selected, currentTarget); // 공격 색을 먼저 정한 뒤 화살표를 그림(같은 프레임에 붉게) ShowAim(selected, currentTarget); - ShowTip(selected, currentTarget); PullZoom((currentTarget - selected.Position).magnitude / Mathf.Max(0.01f, AimMax(selected))); } @@ -730,7 +837,7 @@ namespace TKS if (sys == null || !sys.SlingWait(out t, out max) || t == null) { slinging = slingValid = false; - if (ibArrow != null) ibArrow.End(); + EndArrow(); return; } Vector2 d = w - t.Position; @@ -753,7 +860,7 @@ namespace TKS if (slinging) { OnSlingHold(ScreenToWorld(screen)); - if (ibArrow != null) ibArrow.End(); + EndArrow(); if (battle.Skills != null) { string msg = battle.Skills.SlingRelease(slingValid ? (Vector2?)slingPoint : null); @@ -772,7 +879,7 @@ namespace TKS var u = selected; Sound.Play(SoundKeys.BtRelease); // 소리: 발사(2026-11-20 사운드) HidePreview(); - if (ibArrow != null) ibArrow.End(); + EndArrow(); if (marks != null) marks.HideBubbles(); if (matchup != null) matchup.Hide(); if (u.View != null) u.View.SetAiming(false); @@ -791,7 +898,7 @@ namespace TKS else { HidePreview(); - if (ibArrow != null) ibArrow.End(); + EndArrow(); if (marks != null) marks.HideBubbles(); if (matchup != null) matchup.Hide(); if (dragging && selected != null && selected.View != null) selected.View.SetAiming(false); @@ -847,6 +954,7 @@ namespace TKS range.Show(u); if (u != null && UnitTypeInfo.IsRanged(u.Type)) range.SetArcherReachable(battle.AnyEnemyWithinArcherReach(u)); } + ShowReach(u); // 최대 파워로 공격이 닿는 적 강조(PD 2026-11-23) if (marks != null) marks.ShowTurn(u != null && u.Faction == Faction.Player && battle.CanAct(u) ? u : null); // IB ShowUserTurnMark var guide = TutorialDirector.Current; if (guide != null) guide.OnSelect(u); // 학습 판 안내(unit_select · 누름 안내 닫기 · 조준 안내) @@ -859,6 +967,31 @@ namespace TKS void ShowAim(Unit u, Vector2 target) { if (ibArrow != null) ibArrow.Aim(u, target - u.Position, (target - u.Position).magnitude / Mathf.Max(0.001f, AimMax(u))); + RefreshSkillShape(u, target); + } + + SkillShapeIndicator skillShape; + + /// 조준 중 스킬 범위 표시(시험 · 캡처). + public SkillShapeIndicator SkillShape { get { return skillShape; } } + + /// + /// 예약한 특수 사격의 범위를 조준 방향으로 그린다(PD 2026-11-24 「스킬 범위까지 게임에 모두 반영」 · 레이저 · 관통 · 거대 화살 · 회오리 · 불 장벽 = 직선 · 부채꼴 사격 = 부채꼴 · + /// 폭발 = 떨어질 자리 원 · 모양 = 표 skill_indicator.csv) · 길이 · 폭 = ActionResolver.SkillAim(실제 사격과 같은 질의) · 특수 사격이 없으면 숨김. + /// + void RefreshSkillShape(Unit u, Vector2 target) + { + if (skillShape == null) return; + ActionResolver.SkillAimShape s; + if (u != null && battle != null && battle.Resolver != null && battle.Resolver.SkillAim(u, target, out s)) skillShape.Show(s); + else skillShape.Hide(); + } + + /// 조준 화살표 · 스킬 범위를 함께 걷는다. + void EndArrow() + { + if (ibArrow != null) ibArrow.End(); + if (skillShape != null) skillShape.Hide(); } /// @@ -1020,6 +1153,7 @@ namespace TKS ClearHighlights(); tipTarget = null; if (ibArrow != null) ibArrow.SetAttack(false); + if (skillShape != null) skillShape.Hide(); if (battle != null && battle.Gimmicks != null) battle.Gimmicks.Preview.Hide(); } diff --git a/Assets/Scripts/Runtime/UnitView.cs b/Assets/Scripts/Runtime/UnitView.cs index 5d761efc..80e4bf43 100644 --- a/Assets/Scripts/Runtime/UnitView.cs +++ b/Assets/Scripts/Runtime/UnitView.cs @@ -351,7 +351,8 @@ namespace TKS public void SetAiming(bool on) { if (Sim.Active) return; // 가상 실행(적 AI 예측) = 표시 그대로 - SetAimLift(on && AimRules.DragMode ? Mathf.RoundToInt(IbUi.Num("drag_aim_unit_lift", 11f)) : 0); + // 조준 중 = 조작하는 영웅을 화살표 위로(PD 2026-11-24 「조작하는 유닛은 화살표 등에 가려지면 안 되고 · 다른 아군 · 적군보다는 화살표가 위」 = 끌기 · 게이지 모든 조준 방식 · 2026-11-18 엔 끌기 조준만) + SetAimLift(on ? Mathf.RoundToInt(IbUi.Num("drag_aim_unit_lift", 11f)) : 0); if (anim == null || aiming == on) return; aiming = on; if (on) anim.Play(ClipName("ready"), true); diff --git a/Assets/Scripts/Runtime/VectorRing.cs b/Assets/Scripts/Runtime/VectorRing.cs new file mode 100644 index 00000000..c87193e2 --- /dev/null +++ b/Assets/Scripts/Runtime/VectorRing.cs @@ -0,0 +1,148 @@ +using UnityEngine; + +namespace TKS +{ + /// + /// 벡터 범위 원(PD 2026-11-23 「해상도가 떨어지는 굵은 원형 선 → 개선」 · 「스킬 시전 범위도 수정」) — + /// 또렷한 실선(LineRenderer · 화면 두께 일정 = 기준 1080×1920 px) + 짙은 받침 선 + 가장자리가 진한 은은한 원판(512 px 그라데이션 · 늘려도 계단 없음). + /// 사거리 원(RangeIndicator 모양 2)과 같은 방식 · 스킬 반경 원 · 스킬 지점 선택 반경이 쓴다. 색 · 두께 = 표 ib_ui(부르는 쪽이 넘김). + /// + public class VectorRing : MonoBehaviour + { + const int Segs = 160; + LineRenderer line; + LineRenderer under; + SpriteRenderer disc; + float radius; + + public Color LineColor = Color.white; + public Color UnderColor = new Color(0.23f, 0.14f, 0.08f, 0.35f); + public float LinePx = 4f; + public float UnderPx = 2f; + public float DiscAlpha = 0.12f; + + public float Radius { get { return radius; } } + + // ---------- 공격 인디케이터 모드(PD 2026-11-24 예시 「원형 공격 인디케이터」) ---------- + // 빛나는 바깥 고리 띠 + 안쪽 이중 가는 고리 + 가운데 바닥 빛 + 중심 표적 + 숨쉬기 · 표 ib_ui skill_ind_* + public bool Indicator; + public float InnerFrac = 0.8f; + public float GlowAlpha = 0.55f; + public float CenterAlpha = 0.22f; + public float ReticlePx = 110f; + public float PulseSec = 1.4f; + LineRenderer inner1; + LineRenderer inner2; + SpriteRenderer glow; + SpriteRenderer center; + SpriteRenderer reticleSr; + + public static VectorRing Create(Transform parent, string name, int sortingOrder) + { + var go = new GameObject(name); + go.transform.SetParent(parent, false); + var vr = go.AddComponent(); + var mat = new Material(Shader.Find("Sprites/Default")); + vr.line = NewLine(go.transform, "Line", mat, sortingOrder); + vr.under = NewLine(go.transform, "Under", mat, sortingOrder - 1); + vr.disc = ProceduralSprites.NewSprite(go.transform, "Disc", ProceduralSprites.SoftDisc, Color.white, 1f, sortingOrder - 2); + vr.inner1 = NewLine(go.transform, "Inner1", mat, sortingOrder); + vr.inner2 = NewLine(go.transform, "Inner2", mat, sortingOrder); + vr.glow = ProceduralSprites.NewSprite(go.transform, "Glow", ProceduralSprites.GlowRing, Color.white, 1f, sortingOrder - 2); + vr.center = ProceduralSprites.NewSprite(go.transform, "Center", ProceduralSprites.RadialGlow, Color.white, 1f, sortingOrder - 3); + vr.reticleSr = ProceduralSprites.NewSprite(go.transform, "Reticle", ProceduralSprites.Reticle, Color.white, 1f, sortingOrder + 1); + vr.SetIndicatorParts(false); + return vr; + } + + static LineRenderer NewLine(Transform parent, string name, Material mat, int order) + { + var g = new GameObject(name); + g.transform.SetParent(parent, false); + var lr = g.AddComponent(); + lr.useWorldSpace = false; + lr.loop = true; + lr.positionCount = Segs; + lr.numCapVertices = 0; + lr.numCornerVertices = 0; + lr.alignment = LineAlignment.View; + lr.sharedMaterial = mat; + lr.sortingOrder = order; + return lr; + } + + /// 스킬 범위 모양(표 ib_ui skill_range_* · skill_ind_*)을 읽어 적용 — skill_ind_style 1 = 공격 인디케이터 · 0 = 실선 + 은은한 원판. + public void UseSkillStyle(float discAlpha) + { + Indicator = IbUi.Num("skill_ind_style", 1f) > 0.5f; + LineColor = Indicator ? IbUi.Col("skill_ind_color", new Color(0.25f, 0.85f, 1f, 1f)) : IbUi.Col("skill_range_color", new Color(1f, 0.79f, 0.25f, 0.95f)); + UnderColor = Indicator ? IbUi.Col("skill_ind_under_color", new Color(0.04f, 0.23f, 0.29f, 0.55f)) : IbUi.Col("range_under_color", new Color(0.23f, 0.14f, 0.08f, 0.35f)); + LinePx = Indicator ? IbUi.Num("skill_ind_line_px", 6f) : IbUi.Num("skill_range_px", 4f); + UnderPx = IbUi.Num("range_under_px", 2f); + DiscAlpha = discAlpha; + InnerFrac = IbUi.Num("skill_ind_inner", 0.8f); + GlowAlpha = IbUi.Num("skill_ind_glow", 0.55f); + CenterAlpha = IbUi.Num("skill_ind_center", 0.22f); + ReticlePx = IbUi.Num("skill_ind_reticle_px", 110f); + PulseSec = IbUi.Num("skill_ind_pulse_sec", 1.4f); + } + + /// 반지름(월드)을 정하고 선 · 원판을 다시 놓는다. + public void SetRadius(float r) + { + radius = Mathf.Max(0f, r); + for (int i = 0; i < Segs; i++) + { + float a = i * Mathf.PI * 2f / Segs; + var p = new Vector3(Mathf.Cos(a) * radius, Mathf.Sin(a) * radius, 0f); + line.SetPosition(i, p); + under.SetPosition(i, p); + inner1.SetPosition(i, p * InnerFrac); + inner2.SetPosition(i, p * (InnerFrac - 0.025f)); + } + disc.transform.localScale = new Vector3(radius * 2f, radius * 2f, 1f); + glow.transform.localScale = new Vector3(radius * 2f, radius * 2f, 1f); + center.transform.localScale = new Vector3(radius * 1.3f, radius * 1.3f, 1f); + SetIndicatorParts(Indicator); + Apply(); + } + + void SetIndicatorParts(bool on) + { + inner1.gameObject.SetActive(on); + inner2.gameObject.SetActive(on); + glow.gameObject.SetActive(on); + center.gameObject.SetActive(on); + reticleSr.gameObject.SetActive(on); + disc.gameObject.SetActive(!on); + } + + void LateUpdate() + { + Apply(); + } + + void Apply() + { + if (line == null) return; + var cam = Camera.main; + float wpp = cam != null && cam.orthographic ? cam.orthographicSize * 2f / 1920f : 0.01f; // 기준 화면 1 px 의 월드 길이 + line.widthMultiplier = LinePx * wpp; + under.widthMultiplier = (LinePx + UnderPx) * wpp; + line.startColor = line.endColor = LineColor; + under.startColor = under.endColor = UnderColor; + disc.color = new Color(LineColor.r, LineColor.g, LineColor.b, DiscAlpha); + if (!Indicator) return; + float pulse = 0.75f + 0.25f * Mathf.Sin(Time.unscaledTime * Mathf.PI * 2f / Mathf.Max(0.1f, PulseSec)); + inner1.widthMultiplier = inner2.widthMultiplier = Mathf.Max(1.5f, LinePx * 0.45f) * wpp; + var ic = new Color(LineColor.r, LineColor.g, LineColor.b, LineColor.a * 0.8f); + inner1.startColor = inner1.endColor = ic; + inner2.startColor = inner2.endColor = ic; + glow.color = new Color(LineColor.r, LineColor.g, LineColor.b, GlowAlpha * pulse); + center.color = new Color(LineColor.r, LineColor.g, LineColor.b, CenterAlpha * (0.85f + 0.15f * pulse)); + float rs = ReticlePx * wpp; + reticleSr.transform.localScale = new Vector3(rs, rs, 1f); + reticleSr.color = new Color(1f, 0.97f, 0.88f, 0.95f); + } + } +} diff --git a/Assets/Scripts/Runtime/VectorRing.cs.meta b/Assets/Scripts/Runtime/VectorRing.cs.meta new file mode 100644 index 00000000..e7fec01e --- /dev/null +++ b/Assets/Scripts/Runtime/VectorRing.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 34d5628691d16e34998b4aa40be87f5c \ No newline at end of file diff --git a/Assets/Tests/PlayMode/BattleFlowTests.cs b/Assets/Tests/PlayMode/BattleFlowTests.cs index 62171695..2c42ca6e 100644 --- a/Assets/Tests/PlayMode/BattleFlowTests.cs +++ b/Assets/Tests/PlayMode/BattleFlowTests.cs @@ -1075,6 +1075,64 @@ namespace TKS.Tests Assert.IsFalse(r.DonutVisible); } + /// + /// 조준 중 스킬 범위(PD 2026-11-24 「부채꼴 · 직선 인디케이터 · 스킬 범위까지 게임에 모두 반영」): 예약한 특수 사격 = 표 skill_indicator.csv 모양 · + /// 레이저 = 직선 · 부채꼴 사격 = 부채꼴(각 = 스킬 값) · 폭발 = 떨어질 자리 원 · 모든 부품 = 유닛(0) 아래 층 · 조준을 거두면 숨김. + /// + [UnityTest] + public IEnumerator SkillShape_ReservedShot_TableShape_UnderUnits() + { + yield return Fresh(); + var sling = bm.Sling; + var arc = bm.SpawnUnit(UnitType.Archer, Faction.Player, new Vector2(0f, -5f), "궁병"); + bm.SpawnUnit(UnitType.Spear, Faction.Enemy, new Vector2(0f, 4f), "적창병"); + yield return null; + System.Func reserve = hero => + { + bm.Skills.AttachHero(arc, hero); + bm.Skills.Of(arc).ReadyTurn = bm.TurnNumber; + return bm.Skills.TapActive(arc); + }; + var cases = new[] { new[] { "taishici", SkillKeys.ShotLaser }, new[] { "xiahouyuan", SkillKeys.ShotFan }, new[] { "xushu", SkillKeys.ShotBlast } }; + foreach (var cs in cases) + { + string msg = reserve(cs[0]); + Assert.IsTrue(bm.Skills.Of(arc).Reserved, cs[0] + " 예약: " + msg); + sling.Select(arc); + sling.ShowAimForCapture(arc, arc.Position + Vector2.up * 3f); + var si = sling.SkillShape; + string want = SkillIndicatorTable.Shape(cs[1], "none"); + var kind = want == "line" ? SkillShapeIndicator.Kind.Line : want == "sector" ? SkillShapeIndicator.Kind.Sector : want == "circle" ? SkillShapeIndicator.Kind.Circle : SkillShapeIndicator.Kind.None; + Assert.AreNotEqual(SkillShapeIndicator.Kind.None, kind, cs[1] + " 줄이 표에 있어야 한다"); + Assert.AreEqual(kind, si.Current, cs[0] + " = 표 모양"); + Assert.AreEqual(cs[1], si.Shape.Key); + Assert.Less(si.TopOrder, 0, "유닛(0) 아래 층(PD 「레이어를 영웅보다 하단」)"); + foreach (var rd in si.GetComponentsInChildren(true)) Assert.Less(rd.sortingOrder, 0, rd.name + " 도 유닛 아래"); + Assert.Greater(Vector2.Dot(si.Shape.Dir, Vector2.up), 0.99f, "조준 방향"); + int arrowOrder = Mathf.RoundToInt(IbUi.Num("order_arrow", 10f)); + int heroTop = int.MinValue; + foreach (var sr in arc.View.GetComponentsInChildren(true)) heroTop = Mathf.Max(heroTop, sr.sortingOrder); + Assert.Greater(heroTop, arrowOrder + 1, "조작하는 영웅 = 조준 화살표(테두리 포함) 위(PD 2026-11-24 · 다른 유닛 0 < 화살표 < 조작 영웅)"); + if (cs[1] == SkillKeys.ShotLaser) Assert.Greater(si.Shape.Length, 1f, "레이저 = 화면 끝까지"); + if (cs[1] == SkillKeys.ShotFan) Assert.Greater(si.Shape.Angle, 0f, "부채꼴 각 = 스킬 p3"); + if (cs[1] == SkillKeys.ShotBlast) Assert.Greater(si.Shape.Radius, 0f, "폭발 반경"); + sling.HideAimForCapture(); + Assert.AreEqual(SkillShapeIndicator.Kind.None, si.Current, "조준을 거두면 숨김"); + bm.Skills.TapActive(arc); // 예약 취소 + } + // 특수 사격이 없는 조준 = 스킬 범위 없음 + Assert.IsFalse(bm.Skills.Of(arc).Reserved); + sling.ShowAimForCapture(arc, arc.Position + Vector2.up * 3f); + Assert.AreEqual(SkillShapeIndicator.Kind.None, sling.SkillShape.Current, "예약 없음 = 없음"); + sling.HideAimForCapture(); + // 하후연 패시브 멀티샷(일반 사격 부채꼴) = 표 multishot 줄 켜기 값을 따름(PD 결정 대기 · 꺼져 있으면 없음) + bm.Skills.AttachHero(arc, "xiahouyuan"); + sling.ShowAimForCapture(arc, arc.Position + Vector2.up * 3f); + var want2 = SkillIndicatorTable.On(SkillKeys.Multishot, false) ? SkillShapeIndicator.Kind.Sector : SkillShapeIndicator.Kind.None; + Assert.AreEqual(want2, sling.SkillShape.Current, "멀티샷 = 표 multishot 줄"); + sling.HideAimForCapture(); + } + [UnityTest] public IEnumerator UnitArt_HeroWithArt_PlaysBackIdle_UnitWithoutArt_IsShape() { diff --git a/Assets/Tests/PlayMode/MissionTests.cs b/Assets/Tests/PlayMode/MissionTests.cs index dc2f8c4e..34684b86 100644 --- a/Assets/Tests/PlayMode/MissionTests.cs +++ b/Assets/Tests/PlayMode/MissionTests.cs @@ -618,11 +618,167 @@ namespace TKS.Tests yield return new WaitForSecondsRealtime(0.4f); yield return CaptureUtil.Capture(c, 1080, 2340, Path.Combine(dir, "07_tall_select.png")); + // 00 선택 없음(낮은 띠 안내 「영웅을 선택하세요」 · 세로 가운데 · PD 2026-11-23) + bm.Sling.Select(null); + yield return new WaitForSecondsRealtime(0.6f); + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "00_no_select.png")); + + // 09~11 근접 영웅: 선택 = 최대 파워로 닿는 적 강조 · 닿는 적 쪽 최대 조준 = 붉은 화살표 · 빈 쪽 조준 = 진영 색(PD 2026-11-23 「근접 유닛도 공격 가능한 경우 화살표가 붉은 색」) + Unit melee = null; + foreach (var u in bm.AliveUnits(Faction.Player)) + if (!UnitTypeInfo.IsRanged(u.Type) && bm.CanAct(u)) { melee = u; break; } + Unit near = null; + foreach (var e in bm.AliveUnits(Faction.Enemy)) + if (melee != null && (near == null || Vector2.Distance(e.Position, melee.Position) < Vector2.Distance(near.Position, melee.Position))) near = e; + if (melee != null && near != null) + { + // 캡처용 배치: 가장 가까운 적을 근접 영웅 위쪽 최대 거리 안(0.7배) → 밖(1.35배)으로 옮겨 경계를 보인다 + float max = bm.Sling.AimMax(melee); + Vector2 up = Vector2.up; // 벽 · 기믹에 막히지 않는 방향(최대 거리까지 빈 길)을 고름 + float bestFree = -1f; + for (int k = 0; k < 16; k++) + { + float ang = Mathf.PI * 0.5f + (k % 2 == 0 ? 1f : -1f) * (k / 2) * Mathf.PI / 8f; + var dv = new Vector2(Mathf.Cos(ang), Mathf.Sin(ang)); + float ft = Combat.FreeTravel(melee, melee.Position, dv, max * 1.4f, false, false); + if (ft > bestFree) { bestFree = ft; up = dv; } + if (ft >= max * 1.35f) break; + } + var cc = UnityEngine.Object.FindFirstObjectByType(); + if (cc != null) cc.SnapTo(melee.Position + up * max * 0.62f); + near.Position = melee.Position + up * max * 0.7f; + Physics2D.SyncTransforms(); // 경로 질의 = 물리 CircleCast → 옮긴 자리를 충돌체에 반영 + bm.Sling.Select(melee); + yield return new WaitForSecondsRealtime(0.5f); + var reach = bm.Sling.ReachableAtMax(melee); + float hd; + var fu = Combat.FirstUnitOnPath(melee, melee.Position, up, max, out hd); + log += " · melee=" + melee.DisplayName + " type=" + melee.Type + " bonusMove=" + melee.BonusMoveAvailable + " max=" + max.ToString("0.0") + " gap=" + Vector2.Distance(near.Position, melee.Position).ToString("0.0") + + " predict=" + bm.Resolver.PredictTargets(melee, melee.Position + up * max, false).Count + " firstOnPath=" + (fu != null ? fu.DisplayName + "@" + hd.ToString("0.0") : "-") + + " freeTravel=" + Combat.FreeTravel(melee, melee.Position, up, max, false, false).ToString("0.00") + " hd=" + hd.ToString("0.00") + + " reachPt=" +Vector2.Distance(melee.Position, bm.Resolver.ReachPoint(melee, melee.Position + up * max)).ToString("0.0") + " reachIn=" + reach.Count; + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "09_reach_select.png")); + bm.Sling.ShowAimForCapture(melee, melee.Position + up * max); + yield return new WaitForSecondsRealtime(0.3f); + log += " · aimIn attack=" + bm.Sling.AimShowsAttack; + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "10_aim_max_in_reach.png")); + bm.Sling.HideAimForCapture(); + // 12 사거리 원 모양 0~3 × 공격 가능한 적 있음(PD 2026-11-23 2차 「굵은 베이지색 원형 선 개선 · 사정거리 내 공격 가능한 적이 있을 때 변화」 · 표 ib_ui range_style) + var ri = UnityEngine.Object.FindFirstObjectByType(); + for (int s = 0; s <= 3; s++) + { + RangeIndicator.StyleOverride = s; + bm.Sling.Select(melee); + yield return new WaitForSecondsRealtime(0.35f); + log += " · s" + s + " attack=" + (ri != null && ri.Attackable); + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "12_range_s" + s + "_attack.png")); + } + near.Position = melee.Position + up * max * 1.2f; // 최대 거리 + 두 반지름보다 조금 밖 + Physics2D.SyncTransforms(); + for (int s = 0; s <= 3; s++) + { + RangeIndicator.StyleOverride = s; + bm.Sling.Select(melee); + yield return new WaitForSecondsRealtime(0.35f); + log += " · s" + s + " none=" + (ri != null && !ri.Attackable); + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "13_range_s" + s + "_none.png")); + } + RangeIndicator.StyleOverride = -1; + bm.Sling.Select(melee); + yield return new WaitForSecondsRealtime(0.3f); + log += " · reachOut=" + bm.Sling.ReachableAtMax(melee).Count; + bm.Sling.ShowAimForCapture(melee, melee.Position + up * max); + yield return new WaitForSecondsRealtime(0.3f); + log += " · aimOut attack=" + bm.Sling.AimShowsAttack; + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "11_aim_max_out_of_reach.png")); + bm.Sling.HideAimForCapture(); + } + + // 14 스킬 반경 원(관우 = 행동 반경 · 금 실선 + 은은한 원판) · 15 스킬 지점 선택 반경(변진 = 장합 스킬을 붙여 예약) — PD 2026-11-23 「스킬 시전 범위도 수정」 + Unit guan = null; + foreach (var u in bm.AliveUnits(Faction.Player)) + if (u.DisplayName == "관우") { guan = u; break; } + // 16 스킬 범위 표시 대안 목업 바탕(PD 2026-11-24 「스킬 시전 범위 표시는 전혀 직관적이지 않음 · 다른 방법 제안」) — 관우 반경 안 적 3 · 밖 1 · 스킬 원 숨김 · 화면 좌표 기록 + if (guan != null) + { + bm.Skills.AttachHero(guan, "guanyu"); + float sr = bm.Skills.ActiveRadius(guan); + var foes = new List(bm.AliveUnits(Faction.Enemy)); + foes.Sort((a, b) => Vector2.Distance(a.Position, guan.Position).CompareTo(Vector2.Distance(b.Position, guan.Position))); + float[] dist = { 0.45f, 0.62f, 0.78f, 1.25f }; + float[] ang = { 120f, 88f, 55f, 75f }; + var spots = new List(); + for (int k = 0; k < dist.Length && k < foes.Count; k++) + { + float a = ang[k] * Mathf.Deg2Rad; + foes[k].Position = guan.Position + new Vector2(Mathf.Cos(a), Mathf.Sin(a)) * sr * dist[k]; + spots.Add(foes[k]); + } + Physics2D.SyncTransforms(); + var scc = UnityEngine.Object.FindFirstObjectByType(); + if (scc != null) scc.SnapTo(guan.Position + Vector2.up * sr * 0.45f); + RangeIndicator.HideSkillForCapture = true; + bm.Sling.Select(guan); + bm.Sling.HideAimForCapture(); // 이동 공격 주황 고리도 걷음(목업 바탕) + yield return new WaitForSecondsRealtime(0.5f); + var sb = new StringBuilder("SKILLMOCK"); + System.Func px = w => { var v = c.WorldToViewportPoint(new Vector3(w.x, w.y, 0f)); return new Vector2(v.x * 1080f, (1f - v.y) * 1920f); }; + Vector2 gp = px(guan.Position); + sb.Append(" hero=" + gp.x.ToString("0") + "," + gp.y.ToString("0") + " r=" + (px(guan.Position + Vector2.right * sr).x - gp.x).ToString("0")); + foreach (var e in spots) + { + Vector2 ep = px(e.Position); + bool inside = Vector2.Distance(e.Position, guan.Position) <= sr + e.Radius; + sb.Append(" e=" + ep.x.ToString("0") + "," + ep.y.ToString("0") + "," + (inside ? 1 : 0) + "," + (px(e.Position + Vector2.right * e.Radius).x - ep.x).ToString("0")); + } + Debug.Log("[TKS] " + sb); + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "16_skill_base.png")); + RangeIndicator.HideSkillForCapture = false; + } + + if (guan != null) + { + var gcc = UnityEngine.Object.FindFirstObjectByType(); + if (gcc != null) gcc.SnapTo(guan.Position + Vector2.up * 2f); + bm.Sling.Select(guan); + yield return new WaitForSecondsRealtime(0.4f); + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "14_skill_radius.png")); + // 18 직선(레이저 · 태사자) · 19 부채꼴(하후연 부채꼴 연속 사격) · 20 떨어질 자리 원(서서 폭발) — 예약 → 적 쪽 조준(PD 2026-11-24 「부채꼴 · 직선 인디케이터 · 스킬 범위까지 게임에 모두 반영」 · 유닛 아래 층) + string[][] shots = { new[] { "taishici", "18_skill_line" }, new[] { "xiahouyuan", "19_skill_sector" }, new[] { "xushu", "20_skill_blast" } }; + float aimA = 88f * Mathf.Deg2Rad; + Vector2 aimDir = new Vector2(Mathf.Cos(aimA), Mathf.Sin(aimA)); + foreach (var sh in shots) + { + bm.Skills.AttachHero(guan, sh[0]); + bm.Skills.Of(guan).ReadyTurn = bm.TurnNumber; + string tm = bm.Skills.TapActive(guan); + bm.Sling.Select(guan); + bm.Sling.ShowAimForCapture(guan, guan.Position + aimDir * bm.Sling.AimMax(guan) * 0.8f); + yield return new WaitForSecondsRealtime(0.4f); + var ss = bm.Sling.SkillShape; + log += " · " + sh[0] + "=" + ss.Current + "(" + ss.Shape.Key + " len " + ss.Shape.Length.ToString("0.0") + " drawn " + ss.DrawnLength.ToString("0.0") + " hw " + ss.Shape.HalfWidth.ToString("0.00") + " ang " + ss.Shape.Angle.ToString("0") + " r " + ss.Shape.Radius.ToString("0.0") + " order " + ss.TopOrder + " · " + tm + ")"; + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, sh[1] + ".png")); + bm.Sling.HideAimForCapture(); + if (bm.Skills.Of(guan).Reserved) bm.Skills.TapActive(guan); // 예약 취소 + } + bm.Skills.AttachHero(guan, "zhanghe"); + bm.Skills.TapActive(guan); + yield return new WaitForSecondsRealtime(0.4f); + log += " · teleportArea=" + bm.Sling.TeleportAreaVisible; + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "15_skill_area.png")); + } + // 08 적 턴(붉은 현판 · 낮은 띠 「적군 차례」) bm.Sling.Select(null); bm.RunEnemyTurn(); yield return new WaitForSecondsRealtime(0.5f); yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "08_enemy_turn.png")); + + // 17 패배 결과 화면(PD 2026-11-24 「별 키움 · 둥근 프레임 제거 · 제목 = 패배만 · 스테이지 정보 = 메뉴 안 · 게임 팁 ! 말풍선 · 게임 글꼴 · 글자 키움」) + foreach (var u in bm.AliveUnits(Faction.Player)) u.TakeDamage(u.Hp); + bm.CheckBattleEnd(); + yield return new WaitForSecondsRealtime(1.2f); + yield return CaptureUtil.Capture(c, 1080, 1920, Path.Combine(dir, "17_result_lose.png")); Debug.Log("[TKS] 전투 HUD 캡처 → " + dir + " · " + log); }