ThreeKingdomsSlingshot/Tools/build_meteor_impact.cs

40 lines
1.9 KiB
C#

using UnityEditor;
using UnityEngine;
// 이각 약탈 폭파(2026-11-20 PD 42차 「내가 지시한 이펙트는 범위 형태로 터지는 이펙트」 = Vol.2 HCFX_Meteor_03 의 땅에 닿아 터지는 장면) —
// 원본의 터짐 층(impact_* · glow_floor)은 뿌리 층(떨어지는 바위 · 수명 5 · 중력)이 땅에 닿을 때만 나오는 서브 이미터라
// 바위 낙하 없이 쓰면 터지지 않음(캡처) → 뿌리의 서브 이미터 모듈을 끄고(자식 층이 스스로 시작 0초에 방출) · 뿌리(바위)·떨어지는 층(falling_line · trail · smoke · fog · particle)은 그림을 끈 사본.
// 실행: unity command --project-path . --timeout 300 script eval --file Tools/build_meteor_impact.cs
string src = "Assets/Resources/Fx/TKS_Fx_Sk_HCFX_Meteor_03_Single.prefab";
string dst = "Assets/Resources/Fx/TKS_Fx_C_MeteorImpact.prefab";
if (AssetDatabase.LoadAssetAtPath<GameObject>(dst) != null) AssetDatabase.DeleteAsset(dst);
if (!AssetDatabase.CopyAsset(src, dst)) return "복사 실패";
var go = PrefabUtility.LoadPrefabContents(dst);
go.name = "TKS_Fx_C_MeteorImpact";
var root = go.GetComponent<ParticleSystem>();
var se = root.subEmitters;
int subs = se.subEmittersCount;
se.enabled = false;
var off = new[] { "falling_line", "trail", "smoke", "fog", "particle" };
string log = "";
foreach (var ps in go.GetComponentsInChildren<ParticleSystem>(true))
{
var r = ps.GetComponent<ParticleSystemRenderer>();
bool kill = ps == root || System.Array.IndexOf(off, ps.name) >= 0;
if (kill)
{
var em = ps.emission;
em.enabled = false;
if (r != null) r.enabled = false;
continue;
}
var m = ps.main;
m.playOnAwake = true;
var e2 = ps.emission;
log += ps.name + "(" + e2.burstCount + ") ";
}
PrefabUtility.SaveAsPrefabAsset(go, dst);
PrefabUtility.UnloadPrefabContents(go);
AssetDatabase.SaveAssets();
return "ok " + dst + " · 서브 " + subs + " · 남긴 층 " + log;