20 lines
511 B
C#
20 lines
511 B
C#
|
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>1֮<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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|