// 2026년 포트폴리오용 재구성 코드. 실제 업무 당시 소스가 아닙니다. // 2026 portfolio reconstruction. Not original production source. using System; using UnityEngine; namespace PortfolioExamples { public static class AdaptiveNpcPace { // Signed progress along the same route, not straight-line world distance. public static float Speed(float playerProgress, float npcProgress, float baseSpeed, float comfortDistance) { if (baseSpeed < 0 || comfortDistance <= 0) throw new ArgumentOutOfRangeException(); float gap = Mathf.Clamp((npcProgress - playerProgress) / comfortDistance, -1f, 1f); // Equal progress keeps base speed; only a lead/lag applies a correction. float multiplier = gap >= 0 ? Mathf.Lerp(1f, 0.55f, gap) : Mathf.Lerp(1f, 1.35f, -gap); return baseSpeed * multiplier; } public static bool ShouldReposition(float playerProgress, float npcProgress, float maxLead) => maxLead > 0 && npcProgress - playerProgress > maxLead; } }