_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Battle_Royale/LightBlink.cs

20 lines
511 B
C#
Raw Normal View History

2024-11-21 20:36:16 +08:00
using UnityEngine;
using UnityEngine.UI;
public class LightBlink : MonoBehaviour
{
public Image lightImage; // <20>ƹ<EFBFBD>ͼƬ
public float blinkSpeed; // <20><>˸<EFBFBD>ٶ<EFBFBD>
private void Update()
{
if (lightImage != null)
{
// ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD><CDB8><EFBFBD>ȣ<EFBFBD>ֵ<EFBFBD><D6B5>0<EFBFBD><30><31><EFBFBD><E4B2A8>
float alpha = Mathf.Abs(Mathf.Sin(Time.time * blinkSpeed));
Color color = lightImage.color;
color.a = alpha; // <20>޸<EFBFBD>͸<EFBFBD><CDB8><EFBFBD><EFBFBD>
lightImage.color = color;
}
}
}