35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace TKS.OutGame
|
|
{
|
|
/// <summary>
|
|
/// 그래픽 알파 핑퐁(선택 테두리 등 · Fable 제안서 §3-3 「α 0.6↔1.0 0.8 s」) — 시간 = 실시간(일시정지 무관).
|
|
/// 매 프레임 바뀌므로 자기 캔버스(Frame)로 분리 — 화면 전체가 매 프레임 다시 묶이지 않게(PD 2026-11-10 캔버스 분할).
|
|
/// </summary>
|
|
public class UiPulse : MonoBehaviour
|
|
{
|
|
public float min = 0.6f;
|
|
public float max = 1f;
|
|
public float period = 0.8f;
|
|
Graphic g;
|
|
float baseA = 1f;
|
|
|
|
void Awake()
|
|
{
|
|
g = GetComponent<Graphic>();
|
|
if (g != null) baseA = g.color.a;
|
|
UiLayer.Isolate(gameObject);
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (g == null || period <= 0f) return;
|
|
float t = Mathf.PingPong(Time.unscaledTime / period, 1f);
|
|
var c = g.color;
|
|
c.a = baseA * Mathf.Lerp(min, max, t);
|
|
g.color = c;
|
|
}
|
|
}
|
|
}
|