using UnityEngine; using UnityEngine.UI; namespace TKS.OutGame { /// /// 무지개 등급(신화 · 승급 채 · 2026-11-20 PD 「신화 = 무지개색 · 뽑기 연출의 무지개색 참고」) — 붙은 그래픽 색을 gear_grades s_color 7색 사이로 천천히 바꾼다. /// 속도 = 뽑기 ★★★ 둘레 번짐과 같은 한 바퀴 0.45/초(GachaCutscene.ApplyLight) · 알파는 처음 값을 지킨다. 끄기 = UiRainbow.Set(g, null). /// public class UiRainbow : MonoBehaviour { const float CyclePerSec = 0.45f; Graphic target; Color[] colors; float alpha = 1f; /// colors 가 2개 이상이면 순환 시작 · 아니면 멈춤(그래픽 색은 호출한 쪽이 정한 값 그대로). public static void Set(Graphic g, Color[] colors) { if (g == null) return; var r = g.GetComponent(); if (colors == null || colors.Length < 2) { if (r != null) r.enabled = false; return; } if (r == null) r = g.gameObject.AddComponent(); r.target = g; r.colors = colors; r.alpha = g.color.a; r.enabled = true; r.Tick(); } void Update() { Tick(); } void Tick() { if (target == null || colors == null || colors.Length < 2) return; float u = Mathf.Repeat(Time.unscaledTime * CyclePerSec, 1f) * colors.Length; int i = Mathf.FloorToInt(u) % colors.Length; var c = Color.Lerp(colors[i], colors[(i + 1) % colors.Length], u - Mathf.Floor(u)); c.a = alpha; target.color = c; } } }