Project_WL/AgentScripts/WL816k_Apply.cs

55 lines
2.4 KiB
C#
Raw Permalink Normal View History

// WL-816k — ⑥ 채택안 적용: Farm_Water_WL_F(= E 복사본 + 얕은 물 그라데이션) + shoreFoamEnabled 0
using UnityEngine;
using UnityEditor;
using System.Text;
public static class WL816k_Apply
{
const string MatDir = "Assets/WL/Look/Farm/Materials/";
const string SO = "Assets/WL/Look/Farm/Resources/WL/WLIslandLookSettings.asset";
const string C_Foam = "Color_e1f155248d144786a62fc1585ca21e9a";
const string R_FoamDistance = "Vector1_101dc4546b684d40bc2ff2fc59ab43d5";
const string R_FoamEdge = "Vector1_34f757bec6b8422b9aef3b9d97117a6e";
public static void Run()
{
var sb = new StringBuilder();
string dst = MatDir + "Farm_Water_WL_F.mat";
if (AssetDatabase.LoadAssetAtPath<Material>(dst) == null)
{
bool ok = AssetDatabase.CopyAsset(MatDir + "Farm_Water_WL_E.mat", dst);
sb.AppendLine("복사 E → F " + (ok ? "성공" : "🔴 실패"));
AssetDatabase.Refresh();
}
var F = AssetDatabase.LoadAssetAtPath<Material>(dst);
if (F == null) { sb.AppendLine("🔴 F 로드 실패"); Done(sb); return; }
// 🔴 채택 = ⓑ w2 — 흰 거품이 아니라 **물색을 밝힌 색**으로 얕은 물을 만든다(띠 대체)
F.SetColor(C_Foam, new Color(0.62f, 0.82f, 0.90f, 1f));
F.SetFloat(R_FoamDistance, 2.2f);
F.SetFloat(R_FoamEdge, 3f);
EditorUtility.SetDirty(F);
var so = AssetDatabase.LoadAssetAtPath<ScriptableObject>(SO) as WL.Look.Farm.WLIslandLookSettings;
if (so == null) { sb.AppendLine("🔴 SO 로드 실패"); Done(sb); return; }
so.waterTo = F;
so.shoreFoamEnabled = 0;
EditorUtility.SetDirty(so);
AssetDatabase.SaveAssets();
WL.Look.Farm.WLIslandLookSettings.Invalidate();
sb.AppendLine("F = " + F.name + " · shader " + F.shader.name
+ " · FoamColor " + F.GetColor(C_Foam).ToString("F3")
+ " · FoamDistance " + F.GetFloat(R_FoamDistance)
+ " · FoamEdge " + F.GetFloat(R_FoamEdge));
sb.AppendLine("SO waterMode=" + so.waterMode + " · waterTo=" + so.waterTo.name
+ " · shoreFoamEnabled=" + so.shoreFoamEnabled);
Done(sb);
}
static void Done(StringBuilder sb)
{
System.IO.File.WriteAllText("AgentScripts/WL816k_APPLY.txt", sb.ToString());
Debug.Log("[816k apply]\n" + sb);
}
}