135 lines
7.3 KiB
C#
135 lines
7.3 KiB
C#
// PD #747 2단계 — 트레일 머티리얼 2장 + SlashTrailSettings 에셋 생성 (eval_file 전용)
|
|
// using 금지 · 네임스페이스 풀어 쓰기 (CLAUDE.md §1)
|
|
|
|
public static class WL747_MakeAssets
|
|
{
|
|
const string kMatDir = "Assets/WL/Combat/Materials";
|
|
const string kSetDir = "Assets/WL/Settings/Resources/WL";
|
|
|
|
static UnityEngine.Material MakeTrailMat(string path, bool additive)
|
|
{
|
|
var sh = UnityEngine.Shader.Find("Universal Render Pipeline/Particles/Unlit");
|
|
if (sh == null) { UnityEngine.Debug.LogError("[WL747] URP Particles/Unlit 셰이더를 못 찾았다"); return null; }
|
|
|
|
var m = UnityEditor.AssetDatabase.LoadAssetAtPath<UnityEngine.Material>(path);
|
|
if (m == null) { m = new UnityEngine.Material(sh); UnityEditor.AssetDatabase.CreateAsset(m, path); }
|
|
else m.shader = sh;
|
|
|
|
m.SetFloat("_Surface", 1f); // Transparent
|
|
m.SetFloat("_Blend", additive ? 2f : 0f); // 2 = Additive · 0 = Alpha
|
|
m.SetFloat("_SrcBlend", additive ? 1f : 5f); // One / SrcAlpha
|
|
m.SetFloat("_DstBlend", additive ? 1f : 10f); // One / OneMinusSrcAlpha
|
|
m.SetFloat("_ZWrite", 0f);
|
|
m.SetFloat("_Cull", 0f); // 양면 — 리본은 뒷면도 보인다
|
|
m.SetFloat("_AlphaClip", 0f);
|
|
m.SetFloat("_ColorMode", 0f); // Multiply — 정점색을 곱한다
|
|
m.SetFloat("_SoftParticlesEnabled", 0f);
|
|
m.SetFloat("_CameraFadingEnabled", 0f);
|
|
m.SetFloat("_DistortionEnabled", 0f);
|
|
m.SetColor("_BaseColor", UnityEngine.Color.white);
|
|
m.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
|
m.DisableKeyword("_ALPHATEST_ON");
|
|
m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
|
m.DisableKeyword("_ALPHAMODULATE_ON");
|
|
m.DisableKeyword("_COLOROVERLAY_ON");
|
|
m.DisableKeyword("_COLORCOLOR_ON");
|
|
m.DisableKeyword("_COLORADDSUBDIFF_ON");
|
|
m.renderQueue = 3000;
|
|
UnityEditor.EditorUtility.SetDirty(m);
|
|
return m;
|
|
}
|
|
|
|
static WL.Combat.SlashPrefabEmitterRule Rule(string prefab, params string[] names)
|
|
{
|
|
var r = new WL.Combat.SlashPrefabEmitterRule();
|
|
r.prefabName = prefab;
|
|
r.crescentEmitterNames = names;
|
|
return r;
|
|
}
|
|
|
|
static WL.Combat.SlashTrailClassOverride Look(int id, UnityEngine.Color add, UnityEngine.Color alpha, int[] slots)
|
|
{
|
|
var o = new WL.Combat.SlashTrailClassOverride();
|
|
o.classId = id;
|
|
o.mode = WL.Combat.TrailClassMode.Auto;
|
|
o.overrideLook = true;
|
|
o.colorAdditive = add;
|
|
o.colorAlpha = alpha;
|
|
o.widthScale = 0.53f;
|
|
if (slots != null && slots.Length > 0) { o.overrideWeaponSlots = true; o.weaponSlotIndices = slots; }
|
|
return o;
|
|
}
|
|
|
|
public static void Run()
|
|
{
|
|
System.IO.Directory.CreateDirectory(kMatDir);
|
|
System.IO.Directory.CreateDirectory(kSetDir);
|
|
UnityEditor.AssetDatabase.Refresh();
|
|
|
|
var matAdd = MakeTrailMat(kMatDir + "/M_WL_BladeTrail_Add.mat", true);
|
|
var matAlpha = MakeTrailMat(kMatDir + "/M_WL_BladeTrail_Alpha.mat", false);
|
|
|
|
string setPath = kSetDir + "/SlashTrailSettings.asset";
|
|
var so = UnityEditor.AssetDatabase.LoadAssetAtPath<WL.Combat.SlashTrailSettings>(setPath);
|
|
bool isNew = so == null;
|
|
if (isNew) so = UnityEngine.ScriptableObject.CreateInstance<WL.Combat.SlashTrailSettings>();
|
|
|
|
so.enableWeaponTrail = true;
|
|
so.materialAdditive = matAdd;
|
|
so.materialAlpha = matAlpha;
|
|
so.verboseLog = true; // 1차 Play 실측용 — 확정 후 끈다
|
|
so.burstTiming = WL.Combat.BurstTiming.OnSwingEnd; // PM 결정 ①
|
|
so.burstMode = WL.Combat.BurstMode.ReuseShowEffect;
|
|
|
|
// PM 결정 ③ — 클래스별 룩. Blue = 구 WL NamuFX 실측 피크값,
|
|
// Orange = 그 값의 R↔B 대칭(같은 휘도대), Steel = 연한 노란 백색(Lana 원본 참고 불가).
|
|
var blueAdd = new UnityEngine.Color(0.086f, 1.553f, 2.024f, 1f);
|
|
var blueAlp = new UnityEngine.Color(0f, 0.762f, 1.582f, 1f);
|
|
var orgAdd = new UnityEngine.Color(2.024f, 0.900f, 0.150f, 1f);
|
|
var orgAlp = new UnityEngine.Color(1.582f, 0.520f, 0.050f, 1f);
|
|
var steelAdd = new UnityEngine.Color(1.700f, 1.640f, 1.250f, 1f);
|
|
var steelAlp = new UnityEngine.Color(1.200f, 1.170f, 0.950f, 1f);
|
|
|
|
so.colorAdditive = blueAdd;
|
|
so.colorAlpha = blueAlp;
|
|
|
|
so.classOverrides = new System.Collections.Generic.List<WL.Combat.SlashTrailClassOverride>();
|
|
so.classOverrides.Add(Look(10101, blueAdd, blueAlp, null));
|
|
so.classOverrides.Add(Look(10102, orgAdd, orgAlp, null));
|
|
so.classOverrides.Add(Look(10201, blueAdd, blueAlp, null));
|
|
so.classOverrides.Add(Look(10202, orgAdd, orgAlp, null));
|
|
// 10501·10502 = 메이스+방패. RH(=1) 소켓만 궤적을 그린다(LH 0 = 방패 배제 · ClassConfig 실측).
|
|
so.classOverrides.Add(Look(10501, steelAdd, steelAlp, new int[] { 1 }));
|
|
so.classOverrides.Add(Look(10502, steelAdd, steelAlp, new int[] { 1 }));
|
|
|
|
// PM 결정 ② — 런타임 크레센트 억제(프리팹 에셋 무수정). PLAN §3 실측표.
|
|
// Lana 계열(10501_1·2 / 10502_1·2)은 Play 확인 전까지 넣지 않는다(미확인).
|
|
so.crescentRules = new System.Collections.Generic.List<WL.Combat.SlashPrefabEmitterRule>();
|
|
so.crescentRules.Add(Rule("Effect_Slash_10101_1", "slash_L01", "slash01_blue", "flare02_blue"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10101_2", "slash_L01", "slash01_blue", "flare02_blue"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10101_3", "Center_flash", "Center_flash (1)"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10102_1", "slash_a (1)", "slash_a (2)", "slash_b (1)"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10102_2", "slash_a (1)", "slash_a (2)", "slash_b (1)"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10102_3", "Center_flash", "Center_flash (1)"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10102_4", "Center_flash", "Center_flash (1)"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10201_1", "BlueSlash"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10201_2", "BlueSlash"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10201_3", "BlueSlash"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10202_1", "OrangeSlash"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10202_2", "OrangeSlash"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10202_3", "OrangeSlash", "OrangeSlash (1)"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10202_4", "OrangeSlash", "OrangeSlash (1)"));
|
|
so.crescentRules.Add(Rule("Effect_Slash_10501_3", "Center_flash", "Center_flash (1)"));
|
|
|
|
if (isNew) UnityEditor.AssetDatabase.CreateAsset(so, setPath);
|
|
UnityEditor.EditorUtility.SetDirty(so);
|
|
UnityEditor.AssetDatabase.SaveAssets();
|
|
UnityEditor.AssetDatabase.Refresh();
|
|
|
|
UnityEngine.Debug.Log("[WL747] 에셋 생성 완료 set=" + setPath
|
|
+ " matAdd=" + (matAdd != null) + " matAlpha=" + (matAlpha != null)
|
|
+ " rules=" + so.crescentRules.Count + " overrides=" + so.classOverrides.Count
|
|
+ " loadCheck=" + (UnityEngine.Resources.Load<WL.Combat.SlashTrailSettings>("WL/SlashTrailSettings") != null));
|
|
}
|
|
}
|