115 lines
6.1 KiB
C#
115 lines
6.1 KiB
C#
|
|
// WL-816f — 마무리 실측: ⓐ성능 전(밀도 2.5)/후(1.8) ⓑ밭 칸 표시 유지 ⓒ확장 시 새 타일에 풀
|
|||
|
|
public static class WL816f_Final
|
|||
|
|
{
|
|||
|
|
public static void Start()
|
|||
|
|
{
|
|||
|
|
var go = UnityEngine.GameObject.Find("~WL816fFinal");
|
|||
|
|
if (go != null) UnityEngine.Object.DestroyImmediate(go);
|
|||
|
|
go = new UnityEngine.GameObject("~WL816fFinal");
|
|||
|
|
go.AddComponent<WL816f_FinalRunner>();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public class WL816f_FinalRunner : UnityEngine.MonoBehaviour
|
|||
|
|
{
|
|||
|
|
static System.Text.StringBuilder sb;
|
|||
|
|
void Start() { StartCoroutine(Co()); }
|
|||
|
|
|
|||
|
|
System.Collections.IEnumerator Co()
|
|||
|
|
{
|
|||
|
|
sb = new System.Text.StringBuilder();
|
|||
|
|
if (UnityEngine.SceneManagement.SceneManager.sceneCount < 2)
|
|||
|
|
{
|
|||
|
|
var op = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("Level01", UnityEngine.SceneManagement.LoadSceneMode.Additive);
|
|||
|
|
while (op != null && !op.isDone) yield return null;
|
|||
|
|
}
|
|||
|
|
for (int i = 0; i < 6; i++) yield return new UnityEngine.WaitForSeconds(1f);
|
|||
|
|
|
|||
|
|
var g = UnityEngine.Object.FindFirstObjectByType<WL.Look.Farm.WLIslandGrass>(UnityEngine.FindObjectsInactive.Include);
|
|||
|
|
var src = WL.Look.Farm.WLIslandLookSettings.Instance;
|
|||
|
|
var rt = UnityEngine.Object.Instantiate(src); // 에셋 무변경
|
|||
|
|
g.cfg = rt;
|
|||
|
|
var cam = LiveCam();
|
|||
|
|
|
|||
|
|
// ── ⓐ 성능: 816e(2.5) vs 816f(1.8) vs 풀 없음 ───────────────
|
|||
|
|
L("[성능] 같은 카메라(" + (cam ? cam.name : "?") + ") · 1080×1920 오프스크린 60프레임 평균");
|
|||
|
|
float[] dens = { 2.5f, 1.8f };
|
|||
|
|
for (int k = 0; k < dens.Length; k++)
|
|||
|
|
{
|
|||
|
|
SetD(rt, dens[k]); g.Rebuild(); yield return null; yield return null;
|
|||
|
|
float ms = Bench(cam, 60);
|
|||
|
|
L(" 밀도 " + dens[k].ToString("F2") + " : 인스턴스 " + WL.Look.Farm.WLIslandGrass.Instances
|
|||
|
|
+ " · 삼각형 " + WL.Look.Farm.WLIslandGrass.Triangles
|
|||
|
|
+ " · 드로우콜 +" + WL.Look.Farm.WLIslandGrass.DrawnConfigs
|
|||
|
|
+ " · " + ms.ToString("F3") + " ms/frame (" + (1000f / ms).ToString("F0") + " fps 환산)");
|
|||
|
|
}
|
|||
|
|
g.enabled = false; yield return null; yield return null;
|
|||
|
|
float off = Bench(cam, 60);
|
|||
|
|
L(" 풀 없음 : " + off.ToString("F3") + " ms/frame");
|
|||
|
|
g.enabled = true; SetD(rt, 1.8f); g.Rebuild(); yield return null;
|
|||
|
|
|
|||
|
|
// ── ⓑ 밭 칸 표시가 남아 있나(두 색이 서로 달라야 한다) ──────
|
|||
|
|
L("");
|
|||
|
|
var soils = UnityEngine.Object.FindObjectsByType<CryingSnow.FarmingIsland.Soil>(UnityEngine.FindObjectsInactive.Exclude, UnityEngine.FindObjectsSortMode.None);
|
|||
|
|
var seen = new System.Collections.Generic.Dictionary<string, int>();
|
|||
|
|
for (int i = 0; i < soils.Length; i++)
|
|||
|
|
{
|
|||
|
|
var r = soils[i].GetComponentInChildren<UnityEngine.Renderer>(true);
|
|||
|
|
if (r == null) continue;
|
|||
|
|
var h = UnityEngine.ColorUtility.ToHtmlStringRGB(r.material.color);
|
|||
|
|
seen[h] = seen.ContainsKey(h) ? seen[h] + 1 : 1;
|
|||
|
|
}
|
|||
|
|
L("[밭 칸 표시] Soil " + soils.Length + "개의 색 종류 " + seen.Count + " (2 여야 칸 구분이 살아 있다)");
|
|||
|
|
foreach (var kv in seen) L(" " + kv.Key + " ×" + kv.Value);
|
|||
|
|
|
|||
|
|
// ── ⓒ 확장: 타일 하나를 잠갔다 다시 열어 풀이 따라오는지 ────
|
|||
|
|
L("");
|
|||
|
|
var islands = UnityEngine.Object.FindObjectsByType<CryingSnow.FarmingIsland.Island>(UnityEngine.FindObjectsInactive.Exclude, UnityEngine.FindObjectsSortMode.None);
|
|||
|
|
CryingSnow.FarmingIsland.Island target = null;
|
|||
|
|
for (int i = 0; i < islands.Length; i++)
|
|||
|
|
if (islands[i].IsUnlocked && islands[i].gameObject.activeInHierarchy && islands[i].transform.position != UnityEngine.Vector3.zero) { target = islands[i]; break; }
|
|||
|
|
int before = WL.Look.Farm.WLIslandGrass.Tiles;
|
|||
|
|
if (target != null)
|
|||
|
|
{
|
|||
|
|
target.gameObject.SetActive(false);
|
|||
|
|
yield return new UnityEngine.WaitForSeconds(2.5f);
|
|||
|
|
int mid = WL.Look.Farm.WLIslandGrass.Tiles;
|
|||
|
|
target.gameObject.SetActive(true);
|
|||
|
|
yield return new UnityEngine.WaitForSeconds(3f);
|
|||
|
|
int after = WL.Look.Farm.WLIslandGrass.Tiles;
|
|||
|
|
L("[확장] 풀 깔린 타일 " + before + " → (타일 1개 잠금) " + mid + " → (다시 열기) " + after
|
|||
|
|
+ (after == before ? " ✔ 새로 열린 타일에 풀이 자동으로 깔린다" : " 🔴 복귀 실패"));
|
|||
|
|
}
|
|||
|
|
else L("[확장] 대상 타일 없음(미확인)");
|
|||
|
|
|
|||
|
|
System.IO.File.WriteAllText("AgentScripts/WL816f_FINAL.txt", sb.ToString());
|
|||
|
|
UnityEngine.Debug.Log("[816f final]\n" + sb.ToString());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
static void L(string s) { sb.AppendLine(s); }
|
|||
|
|
static void SetD(WL.Look.Farm.WLIslandLookSettings c, float d)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < c.scatter.Length; i++)
|
|||
|
|
if (c.scatter[i] != null && (c.scatter[i].label.Contains("풀") || c.scatter[i].label.Contains("꽃"))) c.scatter[i].density = d;
|
|||
|
|
}
|
|||
|
|
static UnityEngine.Camera LiveCam()
|
|||
|
|
{
|
|||
|
|
var cams = UnityEngine.Object.FindObjectsByType<UnityEngine.Camera>(UnityEngine.FindObjectsInactive.Exclude, UnityEngine.FindObjectsSortMode.None);
|
|||
|
|
UnityEngine.Camera t = null;
|
|||
|
|
for (int i = 0; i < cams.Length; i++) { var c = cams[i]; if (!c.enabled || c.targetTexture != null) continue; if (t == null || c.depth > t.depth) t = c; }
|
|||
|
|
return t;
|
|||
|
|
}
|
|||
|
|
static float Bench(UnityEngine.Camera cam, int frames)
|
|||
|
|
{
|
|||
|
|
if (cam == null) return -1f;
|
|||
|
|
var rt = new UnityEngine.RenderTexture(1080, 1920, 24, UnityEngine.RenderTextureFormat.ARGB32, UnityEngine.RenderTextureReadWrite.sRGB);
|
|||
|
|
rt.Create(); var prev = cam.targetTexture; cam.targetTexture = rt;
|
|||
|
|
for (int i = 0; i < 10; i++) cam.Render();
|
|||
|
|
var sw = System.Diagnostics.Stopwatch.StartNew();
|
|||
|
|
for (int i = 0; i < frames; i++) cam.Render();
|
|||
|
|
sw.Stop(); cam.targetTexture = prev;
|
|||
|
|
rt.Release(); UnityEngine.Object.DestroyImmediate(rt);
|
|||
|
|
return (float)sw.Elapsed.TotalMilliseconds / frames;
|
|||
|
|
}
|
|||
|
|
}
|