Project_WL/Assets/WL/Combat/Reaction/WLHitBlinkSettings.cs

131 lines
8.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ─────────────────────────────────────────────────────────────────────────────
// WLHitBlinkSettings.cs — 몹 피격 점멸(MaterialPropertyBlock) · 처치 디졸브 엣지 값의 단일 출처(SOT · C45)
//
// PD 지시 #813 · 발주서 WL-811def §1-3 · 구 발주서 WL-802d §3 ⓕ 규격 · 설계안 §C 811f 행 · 기준서 v1 §B 요소 2 (2026-09-09)
//
// 에셋 경로(고정): Assets/WL/Combat/Settings/Resources/WL/WLHitBlinkSettings.asset
// → Resources.Load<WLHitBlinkSettings>("WL/WLHitBlinkSettings") 로 1회 로드 후 캐시.
// 에셋이 없거나 enabled = false 또는 RuntimeDisabled 면 MobHitFlash 가 아무 것도 하지 않는다(C8 · 원본 = 점멸 꺼짐 상태 그대로).
//
// 【프로퍼티명 실측 · 2026-09-09 · Assets/Res_Addr/Mobs/{Mob,Elite,FieldBoss} 299 프리팹 · 머티리얼 참조 355】
// 312 = MK Toon `Assets/_MK/MKToon/Shader/URP/Standard/StandardSimple.shader` → [MainColor] _AlbedoColor · _EmissionColor
// (_EmissionColor 는 Config.hlsl 이 MK_EMISSION 을 항상 정의해 키워드 없이 가산된다 · _BaseColor 없음 · _Color 는 HideInInspector 미사용)
// 나머지 41 = EricWang Alpha Blended / Additive · MasterStylizedFX CommonParticleOneShot(파티클 · arr_Renderer 필터 대상 밖)
// 디졸브 = `ThirdParty/Dissolve Edge by Moonflower Carnivore/Shaders/Transparent_Unlit_DissolveEdge.shader`("MoonflowerCarnivore/Dissolve Edge")
// → 엣지 **색** 프로퍼티는 없고 램프 텍스처(_EdgeAroundRamp) × _EdgeAroundHDR(1~3) · _EdgeAround(범위 0~0.5) 가 색·세기를 정한다.
// _Progress 는 원본 Co_Dissolve 가 sharedMaterial.SetFloat 로 구동하므로 MPB 에 넣지 않는다(넣으면 디졸브가 멈춘다).
// ─────────────────────────────────────────────────────────────────────────────
using UnityEngine;
namespace WL.Combat.Reaction
{
[CreateAssetMenu(fileName = "WLHitBlinkSettings", menuName = "WL/Hit Blink Settings", order = 323)]
public sealed class WLHitBlinkSettings : ScriptableObject
{
public const string ResourcesPath = "WL/WLHitBlinkSettings";
static WLHitBlinkSettings s_cached;
static bool s_lookupDone;
public static WLHitBlinkSettings Instance
{
get
{
if (!s_lookupDone)
{
s_cached = Resources.Load<WLHitBlinkSettings>(ResourcesPath);
s_lookupDone = true;
}
return s_cached;
}
}
/// <summary>진단·A/B 전용 런타임 스위치. 에셋을 건드리지 않고 점멸만 끈다. Play 종료 시 자동 false.</summary>
public static bool RuntimeDisabled;
public static bool Enabled
{
get { var i = Instance; return i != null && i.enabled && !RuntimeDisabled; }
}
public static void ClearCache() { s_cached = null; s_lookupDone = false; }
// ─────────────────────────────────────────── 전체 스위치
[Header("전체 스위치")]
[Tooltip("끄면 점멸·디졸브 엣지 세팅이 전부 비활성(MPB 0) = 원본(점멸 꺼짐) 동작. 롤백 1순위.")]
public bool enabled = true;
[Tooltip("점멸 on/off · 엣지 세팅을 Console 에 남긴다(검증용 · GC 발생).")]
public bool verboseLog = false;
// ─────────────────────────────────────────── 대상
[Header("대상")]
[Tooltip("몬스터(MobActor 계열)만 점멸. off 면 PC 를 뺀 모든 Actor.")]
public bool targetMobsOnly = true;
[Tooltip("메인 PC 가 때린 것만 점멸. off 면 펫·소환수 타격도 점멸.")]
public bool onlyByMainPC = false;
[Tooltip("피해 0(무적·회피)은 점멸하지 않는다.")]
public bool skipWhenDamageZero = true;
// ─────────────────────────────────────────── 점멸
[Header("점멸 (HitConfirmed → MPB on → blinkOnSeconds 뒤 off)")]
[Tooltip("점멸 색(HDR · 알베도 색 프로퍼티에 쓴다). 1 보다 크면 텍스처가 밝게 뜬다 = 흰 번쩍임. 기준서 「흰색 0.03~0.06 s」.\n" +
"PD #816zb — '짧게, 대신 세게'. 2.2 → 3.0.")]
[ColorUsage(true, true)] public Color blinkColor = new Color(3f, 3f, 3f, 1f);
[Tooltip("에미션 프로퍼티도 함께 올린다(MK Toon 은 키워드 없이 가산 · URP Lit 은 _EMISSION 키워드가 켜진 머티리얼만).")]
public bool useEmission = true;
[Tooltip("점멸 에미션 색(HDR). PD #816zb — 0.6 → 0.9 (같은 시간에 더 세게).")]
[ColorUsage(true, true)] public Color blinkEmission = new Color(0.9f, 0.9f, 0.9f, 1f);
[Tooltip("켜져 있는 시간(초 · unscaled). Feel 프리셋 Blink On 0.03.")]
public float blinkOnSeconds = 0.03f;
[Tooltip("한 번 켜진 점멸이 이어질 수 있는 **총 상한**(초 · unscaled · 0 이하면 상한 없음).\n" +
"PD #816zb — 몹이 계속 하얗게 보이던 원인은 ① 임팩트 티어 시간 배수(최대 2.4 → 0.072 s)와\n" +
"② 점멸 중 추가 타격마다 blinkOffAt 을 다시 미루는 연장 경로였다. 연장까지 포함해 첫 점멸 시작 시각 + 이 값에서 끊는다. 0.06 = 발주 규정값.")]
public float blinkMaxSeconds = 0.06f;
[Tooltip("꺼진 뒤 다시 켤 수 있기까지의 최소 간격(초 · unscaled). Feel 프리셋 Blink Off 0.03 — 같은 프레임 다중 히트(스윙 1회 5~7타)를 1회 점멸로 묶는다.")]
public float blinkOffSeconds = 0.03f;
[Tooltip("알베도/베이스 색 프로퍼티 후보(앞에서부터 셰이더에 있는 첫 것을 쓴다 · Shader.FindPropertyIndex 실측). 없으면 그 렌더러는 건너뜀.")]
public string[] colorProperties = new string[] { "_AlbedoColor", "_BaseColor" };
[Tooltip("에미션 색 프로퍼티 후보.")]
public string[] emissionProperties = new string[] { "_EmissionColor" };
// ─────────────────────────────────────────── 디졸브 엣지
[Header("처치 디졸브 엣지 (Killed → MPB 로 엣지 세기·범위 · 원본 Co_Dissolve 무수정)")]
[Tooltip("처치 등급별 디졸브 엣지 세기/범위를 MPB 로 미리 얹는다(0.5 s 뒤 원본이 디졸브 머티리얼로 바꾸는 순간 적용).")]
public bool dissolveEdgeEnabled = true;
[Tooltip("디졸브 셰이더 이름(InGameInfo.mat_Dissolve 가 없을 때 Shader.Find 폴백 · 실측 \"MoonflowerCarnivore/Dissolve Edge\").")]
public string dissolveShaderName = "MoonflowerCarnivore/Dissolve Edge";
[Tooltip("엣지 세기 프로퍼티(실측 _EdgeAroundHDR · 머티리얼 기본 1.8 · 범위 1~3).")]
public string dissolveEdgeHdrProperty = "_EdgeAroundHDR";
[Tooltip("엣지 범위 프로퍼티(실측 _EdgeAround · 머티리얼 기본 0.157 · 범위 0~0.5).")]
public string dissolveEdgeRangeProperty = "_EdgeAround";
[Tooltip("일반 몹 엣지 세기(음수 = 머티리얼 값 유지).")]
public float dissolveEdgeHdrNormal = 2f;
[Tooltip("엘리트 엣지 세기.")]
public float dissolveEdgeHdrElite = 2.5f;
[Tooltip("보스 엣지 세기.")]
public float dissolveEdgeHdrBoss = 3f;
[Tooltip("일반 몹 엣지 범위(음수 = 머티리얼 값 유지).")]
public float dissolveEdgeRangeNormal = -1f;
[Tooltip("엘리트 엣지 범위.")]
public float dissolveEdgeRangeElite = 0.22f;
[Tooltip("보스 엣지 범위.")]
public float dissolveEdgeRangeBoss = 0.3f;
}
}