Project_WL/AgentScripts/WL762_Apply.cs

104 lines
4.7 KiB
C#
Raw Normal View History

WL 리뉴얼 세션 2026-09-06~07 (#760~#800) — 전투·배경·UI·타격감 (조직 PD 로그 #746~#800 · 대화로그 §14~§24) - 전투: Knight@Attack1~3_S 3콤보(4 컨트롤러·클래스별 서브클립) · 타겟팅 4규칙(정면 우선·재타겟·즉시 공격·어그로 금지 · WLTargetingSettings) · 대쉬 후 공격(Stander@Chase_Start · DashDriver · 5 m · 사정거리+0.8 · 근거리 적 우선) · 공격 이동 FrameTable(발 접지 실측 표 · AttackRootMotion) · 충돌 반경/투사체 0.3 배(WLCollisionTuning) · 무적(임시)·펫 금지(WLGameplaySettings) - 검기: NamuFX Slash_B 배리언트 Effect_WLSwingArc 원 피팅 정합 배치 + 캘리브레이션(SlashArcMeasure · SlashTrailSettings) · 찌르기 Effect_WLStab 대기 · 램프 리본(BladeTrail · WL_BladeRibbon.shader · T_WL_BladeRibbonRamp) 보존(drawRibbon 0) - 타격감: Assets/WL/Feel(WLHitFeel · 히트스톱 0.03 · 셰이크 0.10 m · 몹 펀치 1.12 · Actor.Get_Damage 훅 1줄 · 원본 RealCamera 셰이크 결함 대체) - 배경/맵: LMHPOLY Demo_01~10 → WL_Nature01~10(프리팹·씬·NavMesh·스포너·BattleMapConfig) · 물(ToonWaterU) · 포스트 블룸 0.9/0.3 · 잔디(BruteForce·드레싱) 제거 · 마젠타 머티리얼 URP 변환 - UI: 세로 HUD(WL_HUD · 하단 5메뉴 폭 전체 · 채팅/전투 패드 숨김 · WLIngameUiOverride) · Title/TitleInfo 1080×1920 Expand + 배경 높이 fit(WLBackgroundFit) · 로딩 SortOrder_5(WLRawImageAspectSync · 초점표 8장) · Loading1~8 ASTC 6×6 - 도구: AgentScripts/*(LightProbe · WL_MapSwitch · WL760~WL800 프로브/집행/검증 · 상단 사용법 주석) · 에디터 락 프로토콜 파일(staging) - 제외(별도 커밋 예정): Assets/LMHPOLY(703 MB) · Assets/Feel(422 MB) · Assets/Shinabro(300 MB) — 에셋 스토어/구 WL 팩 원본 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-06 23:24:25 +00:00
// WL762_Apply.cs — PD 지시 #762 집행 (에디트 모드)
// unity command run_script --file AgentScripts/WL762_Apply.cs --entry WL762_Apply.CreateSettings
// unity command run_script --file AgentScripts/WL762_Apply.cs --entry WL762_Apply.AddMoveEvents
// unity command run_script --file AgentScripts/WL762_Apply.cs --entry WL762_Apply.RemoveMoveEvents (롤백)
// ① WLCombatMotionSettings.asset 생성 ② 9개 서브클립에 Move 애니메이션 이벤트 추가.
// 거리 = M1 실측 루트 전진량(RootT.z max) × 0.4, 0.05 반올림. 시각 = Paladin 원본 Move 시각(실측).
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
public static class WL762_Apply
{
const string SettingsDir = "Assets/WL/Settings/Resources/WL";
const string SettingsPath = SettingsDir + "/WLCombatMotionSettings.asset";
public static object CreateSettings()
{
var existing = AssetDatabase.LoadAssetAtPath<WL.Combat.WLCombatMotionSettings>(SettingsPath);
if (existing != null) return "already exists: " + SettingsPath;
var so = ScriptableObject.CreateInstance<WL.Combat.WLCombatMotionSettings>();
AssetDatabase.CreateAsset(so, SettingsPath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
return "created: " + SettingsPath;
}
// fbx 경로 → (클립이름, Move 시각, Move 거리)
static readonly object[][] Targets =
{
new object[]{ "Assets/Res_Addr/Animations/Animation/Paladin/attack.FBX",
new[]{"Sword&Shield_Attack1_10101","Sword&Shield_Attack1_10102","Sword&Shield_Attack1_10501"}, 0.11957f, 0.30f },
new object[]{ "Assets/Res_Addr/Animations/Animation/Paladin/Stander@Sword&Shield_Attack2.FBX",
new[]{"Sword&Shield_Attack2_10101","Sword&Shield_Attack2_10102","Sword&Shield_Attack2_10501"}, 0.06759f, 0.70f },
new object[]{ "Assets/Res_Addr/Animations/Animation/Paladin/Stander@Sword&Shield_Attack3.FBX",
new[]{"Sword&Shield_Attack3_10101","Sword&Shield_Attack3_10102","Sword&Shield_Attack3_10501"}, 0.05169f, 0.65f },
};
public static object AddMoveEvents() { return Edit(true); }
public static object RemoveMoveEvents() { return Edit(false); }
static object Edit(bool add)
{
var sb = new StringBuilder();
foreach (var row in Targets)
{
string fbx = (string)row[0];
var names = (string[])row[1];
float time = (float)row[2];
float dist = (float)row[3];
var imp = AssetImporter.GetAtPath(fbx) as ModelImporter;
if (imp == null) { sb.AppendLine("importer 없음: " + fbx); continue; }
var clips = imp.clipAnimations;
bool dirty = false;
for (int i = 0; i < clips.Length; i++)
{
if (!names.Contains(clips[i].name)) continue;
var evs = new List<AnimationEvent>(clips[i].events ?? new AnimationEvent[0]);
int removed = evs.RemoveAll(e => e.functionName == "Move");
if (add)
{
evs.Add(new AnimationEvent { functionName = "Move", time = time, floatParameter = dist, intParameter = 0, stringParameter = "" });
}
evs.Sort((a, b) => a.time.CompareTo(b.time));
clips[i].events = evs.ToArray();
dirty = true;
sb.AppendLine(string.Format(" {0}: Move {1} (기존 {2}개 제거) time={3:F5} f={4:F2} → 총 {5}개 이벤트",
clips[i].name, add ? "추가" : "삭제", removed, time, dist, evs.Count));
}
if (!dirty) { sb.AppendLine("대상 클립 없음: " + fbx); continue; }
imp.clipAnimations = clips;
EditorUtility.SetDirty(imp);
imp.SaveAndReimport();
sb.AppendLine("reimported: " + fbx);
}
AssetDatabase.Refresh();
return sb.ToString();
}
/// <summary>현재 9개 서브클립의 이벤트를 다시 읽어 검증한다.</summary>
public static object Verify()
{
var sb = new StringBuilder();
foreach (var row in Targets)
{
string fbx = (string)row[0];
var imp = AssetImporter.GetAtPath(fbx) as ModelImporter;
if (imp == null) continue;
foreach (var ca in imp.clipAnimations)
{
var evs = ca.events ?? new AnimationEvent[0];
sb.AppendLine(string.Format(" {0,-32} : {1}", ca.name,
string.Join(" | ", evs.Select(e => string.Format("{0}@{1:F5}(f={2:F2})", e.functionName, e.time, e.floatParameter)).ToArray())));
}
}
return sb.ToString();
}
}